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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --mute: rgba(0, 0, 0, 0.62);
  --hair: rgba(0, 0, 0, 0.16);
  --soft: rgba(0, 0, 0, 0.04);
  --u: 8px;
  --serif: 'EB Garamond', 'Crimson Text', Georgia, 'Songti SC', 'SimSun', serif;
  --sans: 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --max: 1280px;
  --gut: clamp(16px, 4vw, 40px);
}

*,
*::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(--sans);
  font-size: 17px;
  line-height: 1.68;
  font-weight: 400;
  letter-spacing: 0.012em;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
}

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

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 90;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

.skip:focus {
  left: 0;
}

/* ——— 顶部：品牌居中，菜单分列两侧 ——— */
.top {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--gut);
}

.pillnav ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) clamp(9rem, 17vw, 15rem) repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  grid-auto-flow: row;
}

.pillnav ol::before {
  content: "";
  grid-column: 4;
  grid-row: 1;
}

.pillnav li {
  grid-row: 1;
  min-width: 0;
}

.pillnav li:nth-child(-n + 3) {
  justify-self: start;
}

.pillnav li:nth-child(n + 4) {
  justify-self: end;
}

.pillnav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
  background: var(--paper);
  transition: background 0.18s ease, color 0.18s ease;
}

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

.brand {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  white-space: nowrap;
  z-index: 2;
}

.brand .mark {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* ——— 二级粘性锚点条 ——— */
.strip {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.strip-in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 6px var(--gut);
  display: flex;
  align-items: center;
  gap: 10px;
}

.strip ol {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.strip ol::-webkit-scrollbar {
  display: none;
}

.strip a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  text-decoration: none;
  color: var(--mute);
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.strip a:hover,
.strip a[aria-current='true'] {
  color: var(--ink);
  border-color: var(--ink);
}

.strip .totop {
  flex: 0 0 auto;
  color: var(--ink);
  border-color: var(--ink);
}

/* ——— 首屏 ——— */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) var(--gut);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
  align-items: center;
  min-height: 45vh;
}

.hero-media {
  position: relative;
  grid-column: 1 / span 5;
  border: 1px solid var(--ink);
  border-radius: 4px;
  overflow: hidden;
  background: var(--ink);
  aspect-ratio: 4 / 3;
}

.hero-media .hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-media .plate {
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 25%) ,
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 25%),
    var(--ink);
}

.badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  border: 1px solid var(--ink);
}

.hero-text {
  grid-column: 7 / span 6;
  text-align: center;
}

.hero-text h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0.005em;
  margin: 0 0 18px;
}

.lede {
  margin: 0 auto;
  max-width: 36ch;
  color: var(--mute);
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* ——— 正文栅格 ——— */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) var(--gut);
}

.wrap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.body {
  grid-column: 1 / span 8;
}

main section[id],
main [id] {
  scroll-margin-top: 76px;
}

.content {
  font-size: 1.0625rem;
  line-height: 1.75;
}

.content section + section {
  border-top: 1px solid var(--hair);
  margin-top: 3rem;
  padding-top: 2rem;
}

.content h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  line-height: 1.14;
  margin: 0 0 12px;
}

.content h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.25;
  margin: 1.8rem 0 10px;
}

.content hr {
  border: 0;
  border-top: 1px solid var(--ink);
  margin: 0 0 20px;
}

.content p {
  margin: 0 0 1.1rem;
}

.content ul,
.content ol {
  margin: 0 0 1.2rem;
  padding-left: 1.3rem;
}

.content li {
  margin: 0.35rem 0;
}

.content a {
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.content a:hover {
  background: var(--soft);
}

.content blockquote {
  margin: 1.4rem 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--ink);
  color: var(--mute);
  font-family: var(--serif);
  font-size: 1.15rem;
}

.content img {
  border: 1px solid var(--ink);
  border-radius: 4px;
  margin: 0 0 1.2rem;
}

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

.content th,
.content td {
  border: 1px solid var(--hair);
  padding: 8px 10px;
  text-align: left;
}

.content th {
  border-color: var(--ink);
}

/* ——— 右侧目录 ——— */
.side {
  grid-column: 10 / span 3;
  position: sticky;
  top: 68px;
  align-self: start;
}

.side h2 {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  margin: 0 0 10px;
}

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

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

.side li {
  counter-increment: toc;
  border-bottom: 1px solid var(--hair);
}

.side a {
  display: flex;
  gap: 10px;
  align-items: baseline;
  min-height: 40px;
  padding: 10px 0;
  text-decoration: none;
  font-size: 16px;
  line-height: 1.45;
}

.side a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--serif);
  font-size: 16px;
  color: var(--mute);
  flex: 0 0 auto;
}

.side a:hover {
  color: var(--mute);
}

/* ——— 页脚 ——— */
footer {
  border-top: 1px solid var(--ink);
  margin-top: clamp(36px, 6vw, 72px);
}

.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px var(--gut) 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: baseline;
}

.foot dl {
  margin: 0;
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  min-height: 40px;
}

.foot dt {
  font-size: 16px;
  letter-spacing: 0.16em;
  color: var(--mute);
}

.foot dd {
  margin: 0;
  font-size: 16px;
  font-family: var(--serif);
  letter-spacing: 0.04em;
}

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

.cr {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4px var(--gut) 28px;
  font-size: 16px;
  color: var(--mute);
  letter-spacing: 0.1em;
}

/* ——— 滚动显现 ——— */
.js .rv {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.js .rv.in {
  opacity: 1;
  transform: none;
}

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

  .js .rv {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .pillnav a,
  .strip a {
    transition: none;
  }
}

/* ——— 断点 ——— */
@media (max-width: 1080px) {
  .body {
    grid-column: 1 / span 8;
  }

  .side {
    grid-column: 9 / span 4;
  }
}

@media (max-width: 940px) {
  .top {
    padding: 12px var(--gut) 10px;
  }

  .pillnav ol {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .pillnav ol::-webkit-scrollbar {
    display: none;
  }

  .pillnav ol::before {
    display: none;
  }

  .pillnav li {
    flex: 0 0 auto;
    justify-self: auto;
  }

  .brand {
    position: static;
    transform: none;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 16px;
    min-height: 0;
    padding-top: 20px;
  }

  .hero-text {
    grid-column: 1;
    order: 1;
  }

  .hero-media {
    grid-column: 1;
    order: 2;
    aspect-ratio: 16 / 9;
  }

  .wrap {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .body,
  .side {
    grid-column: 1;
  }

  .side {
    position: static;
    border-top: 1px solid var(--ink);
    padding-top: 16px;
  }

  .foot {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 16px;
  }

  .hero-text h1 {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .content {
    font-size: 16px;
  }

  .strip .totop {
    padding: 0 10px;
  }
}

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