@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Libre+Baskerville:wght@400;700&display=swap');

:root {
  --ink: #000000;
  --paper: #ffffff;
  --muted: #4d4d4d;
  --hair: rgba(0, 0, 0, 0.16);
  --serif: "Cormorant Garamond", "Libre Baskerville", "Songti SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --step: clamp(1rem, 4vw, 2.5rem);
  --max: 1200px;
  --radius: 10px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

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

.page {
  max-width: var(--max);
  margin: 0 auto;
}

.menu-toggle {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- 顶栏：品牌行 + 菜单行 ---------- */
.top {
  padding: 0.9rem var(--step) 0.85rem;
  border-bottom: 2px solid var(--ink);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 44px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}

.brand-img {
  height: 30px;
  width: auto;
}

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.35rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
}

.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2.05rem);
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.55rem;
}

.burger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.35rem 1rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-size: 1rem;
  letter-spacing: 0.18em;
  cursor: pointer;
  user-select: none;
  transition: background 0.22s ease, color 0.22s ease;
}

.burger::before {
  content: "";
  width: 18px;
  height: 8px;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.menu-toggle:checked ~ .top .burger {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- 全屏菜单 ---------- */
.menu {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--paper);
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.menu-toggle:checked ~ .menu {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.menu-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.9rem var(--step) 3rem;
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 2px solid var(--ink);
}

.menu-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: 0.2em;
}

.menu-close {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 1rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-size: 1rem;
  letter-spacing: 0.18em;
  cursor: pointer;
  user-select: none;
  transition: background 0.22s ease, color 0.22s ease;
}

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

.search {
  display: grid;
  gap: 0.4rem;
  margin-top: 1.2rem;
}

.search-label {
  font-size: 1rem;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.search-input {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.search-input::placeholder {
  color: var(--muted);
}

.menu-nav {
  margin-top: 1.6rem;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}

.menu-list li {
  border-bottom: 1px solid var(--hair);
}

.menu-list li.is-filtered {
  display: none;
}

.menu-list a {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0.45rem 0;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.35rem, 4.4vw, 2rem);
  line-height: 1.2;
  transition: padding-left 0.22s ease, opacity 0.22s ease;
}

.menu-list a:hover {
  padding-left: 0.75rem;
}

.menu-toggle:checked ~ .menu .menu-list li {
  animation: rise 0.28s ease both;
}

.menu-toggle:checked ~ .menu .menu-list li:nth-child(2) { animation-delay: 0.03s; }
.menu-toggle:checked ~ .menu .menu-list li:nth-child(3) { animation-delay: 0.06s; }
.menu-toggle:checked ~ .menu .menu-list li:nth-child(4) { animation-delay: 0.09s; }
.menu-toggle:checked ~ .menu .menu-list li:nth-child(5) { animation-delay: 0.12s; }
.menu-toggle:checked ~ .menu .menu-list li:nth-child(6) { animation-delay: 0.15s; }
.menu-toggle:checked ~ .menu .menu-list li:nth-child(7) { animation-delay: 0.18s; }

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

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 45vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: clamp(2rem, 8vw, 4rem) var(--step) clamp(2.8rem, 9vw, 4.5rem);
  border-bottom: 1px solid var(--ink);
  border-radius: 0 0 50% 50% / 0 0 54px 54px;
}

.hero-fig {
  position: absolute;
  inset: 0;
  margin: 0;
  z-index: 0;
  overflow: hidden;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.16;
  filter: grayscale(1);
}

.hero-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(3rem, 17vw, 11rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  opacity: 0.07;
  white-space: nowrap;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 40rem;
}

.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 7.4vw, 4.2rem);
  line-height: 1.08;
  letter-spacing: 0.01em;
}

/* ---------- 正文 + 右侧栏 ---------- */
.stream {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  padding: clamp(2rem, 5vw, 3rem) var(--step) clamp(2.5rem, 7vw, 4rem);
}

.prose {
  min-width: 0;
  counter-reset: sec;
}

.prose > section {
  padding: 2.2rem 0;
  border-top: 1px solid var(--ink);
  scroll-margin-top: 1.5rem;
}

.prose > section:first-child {
  padding-top: 0;
  border-top: 0;
}

.prose > section::before {
  counter-increment: sec;
  content: counter(sec, decimal-leading-zero);
  display: block;
  margin-bottom: 0.4rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1;
  opacity: 0.18;
}

.prose small {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.prose h2 {
  margin: 0.2rem 0 0.9rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.prose h3 {
  margin: 1.6rem 0 0.6rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  line-height: 1.3;
}

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

.prose ul,
.prose ol {
  margin: 0 0 1.1em;
  padding-left: 1.3em;
}

.prose li {
  margin: 0.35em 0;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose img {
  margin: 1.4rem 0;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
}

.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.4rem 0 0.4rem 1.1rem;
  border-left: 3px solid var(--ink);
  font-family: var(--serif);
  font-size: 1.15rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 1rem;
}

.prose th,
.prose td {
  border: 1px solid var(--ink);
  padding: 0.5rem 0.6rem;
  text-align: left;
}

.prose code,
.prose pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
}

.prose pre {
  padding: 0.9rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  overflow-x: auto;
}

.side {
  border-top: 1px solid var(--ink);
  padding-top: 1rem;
  font-size: 1rem;
}

.side small {
  display: block;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.side h2 {
  margin: 0.2rem 0 0.9rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.2;
}

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.15rem 1rem;
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0.35rem 0;
  text-decoration: none;
  color: var(--ink);
  line-height: 1.4;
  transition: padding-left 0.22s ease, opacity 0.22s ease;
}

.toc a:hover {
  padding-left: 0.4rem;
}

/* ---------- 页脚 ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: clamp(2rem, 5vw, 2.8rem) var(--step);
  border-top: 2px solid var(--ink);
}

.foot p {
  margin: 0;
}

.foot small {
  font-size: 1rem;
  color: var(--muted);
}

.foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: opacity 0.22s ease;
}

.foot a:hover {
  opacity: 0.6;
}

/* ---------- 断点 ---------- */
@media (min-width: 720px) {
  .tool-row {
    margin-top: 0.7rem;
  }
}

@media (min-width: 920px) {
  .stream {
    grid-template-columns: minmax(0, 1fr) 15rem;
    gap: 3.5rem;
    align-items: start;
  }

  .side {
    border-top: 0;
    border-left: 1px solid var(--ink);
    padding: 0 0 0 1.25rem;
    position: sticky;
    top: 1.25rem;
  }

  .toc {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

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