@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Josefin+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --paper: #ffffff;
  --wash: #f5f5f7;
  --ink: #1f1f1f;
  --ink-mid: #4a4a50;
  --ink-soft: #75757d;
  --line: #e4e4e8;
  --accent-line: #e9e9ee;
  --radius: 10px;
  --radius-lg: 18px;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 22px 44px -30px rgba(0, 0, 0, 0.42);
  --serif: 'Cinzel', 'Songti SC', 'Noto Serif SC', 'SimSun', serif;
  --sans: 'Josefin Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --head-h: 112px;
}

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

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

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.78;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

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

a {
  color: inherit;
}

p {
  margin: 0 0 14px;
}

ul,
ol {
  margin: 0 0 14px;
  padding-left: 1.25em;
}

li {
  margin: 0 0 6px;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

small {
  font-size: 16px;
  line-height: 1.5;
}

button {
  font-family: inherit;
}

/* ---------- 顶栏 ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.93);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.top__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 16px;
}

.top__mark {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.3em;
  color: var(--ink-soft);
}

.brand {
  justify-self: center;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.16em;
  text-decoration: none;
  color: var(--ink);
  padding: 10px 6px;
  white-space: nowrap;
}

.menu-btn {
  justify-self: end;
  min-height: 44px;
  padding: 0 16px;
  font-size: 16px;
  letter-spacing: 0.12em;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
}

.menu-btn[aria-expanded='true'] {
  background: var(--ink);
  color: var(--paper);
}

.top__aside {
  display: none;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 6px 16px 14px;
}

body.nav-open .top__aside {
  display: block;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 10px;
  font-size: 16px;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--ink-mid);
  border-radius: 8px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: var(--wash);
  color: var(--ink);
}

/* ---------- 主体 ---------- */

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 16px 36px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 18px;
  align-items: center;
  min-height: 45vh;
  padding: 24px 20px 34px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  background: repeating-linear-gradient(118deg, var(--ink) 0 26px, transparent 26px 62px);
  opacity: 0.9;
}

.hero__lead {
  position: relative;
  z-index: 2;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 5.2vw, 50px);
  line-height: 1.22;
  letter-spacing: 0.02em;
}

.hero__desc {
  margin: 0;
  max-width: 46ch;
  color: var(--ink-mid);
}

.hero__figure {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.hero__pic {
  width: 100%;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.35s ease;
}

.hero__pic--a {
  aspect-ratio: 4 / 5;
}

.hero__pic--b {
  aspect-ratio: 1 / 1;
  align-self: end;
  transform: translateY(14px);
}

.hero__pic--a:hover {
  transform: scale(1.02);
}

.hero__pic--b:hover {
  transform: translateY(14px) scale(1.02);
}

.board {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

/* ---------- 左侧索引 ---------- */

.toc {
  background: var(--paper);
  border-radius: var(--radius);
  border-bottom: 3px solid var(--ink);
  box-shadow: var(--shadow);
  padding: 18px 16px;
}

.toc small {
  display: block;
  letter-spacing: 0.32em;
  color: var(--ink-soft);
}

.toc h2 {
  margin: 2px 0 12px;
  font-size: 22px;
}

.toc nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 10px;
  font-size: 16px;
  text-decoration: none;
  color: var(--ink-mid);
  border-left: 2px solid var(--line);
  border-radius: 0 8px 8px 0;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.toc a:hover,
.toc a:focus-visible {
  border-left-color: var(--ink);
  background: #fafafb;
  color: var(--ink);
}

/* ---------- 正文 ---------- */

.prose {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.prose > article {
  background: var(--paper);
  border-radius: var(--radius);
  border-bottom: 3px solid var(--accent-line);
  box-shadow: var(--shadow);
  padding: 22px 18px;
  scroll-margin-top: var(--head-h);
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.prose > article:hover {
  border-bottom-color: var(--ink);
}

.prose h2 {
  margin: 0 0 12px;
  font-size: clamp(21px, 3.2vw, 27px);
}

.prose h3 {
  margin: 20px 0 8px;
  font-size: 19px;
}

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

.prose a {
  color: var(--ink);
  text-decoration-color: #b6b6bd;
  text-underline-offset: 3px;
}

.prose blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--ink);
  background: var(--wash);
  color: var(--ink-mid);
}

.prose figure {
  margin: 16px 0;
}

.prose figcaption {
  margin-top: 6px;
  color: var(--ink-soft);
}

.prose img {
  border-radius: var(--radius);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
}

.prose :target {
  box-shadow: 0 0 0 2px var(--ink), var(--shadow);
}

/* ---------- 页脚 ---------- */

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 16px 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  border-top: 1px solid var(--line);
}

.foot__brand a {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.foot nav {
  flex: 1 1 300px;
  min-width: 0;
}

.foot nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
}

.foot nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 8px;
  font-size: 16px;
  color: var(--ink-mid);
  text-decoration: none;
  border-radius: 6px;
}

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

.foot__copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
}

/* ---------- 回到顶部 ---------- */

.to-top {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 60;
  display: none;
  min-height: 44px;
  padding: 0 18px;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.to-top.is-on {
  display: block;
}

/* ---------- 动效 ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.reveal-in {
  opacity: 1;
  transform: none;
}

/* ---------- 断点 ---------- */

@media (min-width: 880px) {
  .menu-btn {
    display: none;
  }

  .top__bar {
    padding: 10px 20px;
  }

  .top__aside {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px 8px;
    background: transparent;
    border-top: 0;
  }

  body.nav-open .top__aside {
    display: flex;
  }

  .site-nav ul {
    flex-direction: row;
    gap: 2px;
  }

  .site-nav--l {
    border-right: 1px solid var(--line);
    padding-right: 12px;
  }

  .site-nav--r {
    padding-left: 12px;
  }

  main {
    padding: 26px 20px 48px;
  }

  .hero {
    grid-template-columns: 1.12fr 0.88fr;
    gap: 34px;
    padding: 44px 40px 52px;
  }

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

  .board {
    grid-template-columns: 252px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .toc {
    position: sticky;
    top: 124px;
  }

  .prose > article {
    padding: 30px 28px;
  }

  .prose > article:hover {
    transform: scale(1.008);
  }

  .foot {
    padding: 24px 20px 44px;
  }
}

@media (min-width: 1080px) {
  .board {
    grid-template-columns: 268px minmax(0, 1fr);
    gap: 28px;
  }
}

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

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero__pic,
  .prose > article,
  .site-nav a,
  .toc a {
    transition: none;
  }

  .prose > article:hover {
    transform: none;
  }
}

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