html {
  scroll-behavior: smooth;
}

:root {
  --paper: #f5e6c8;
  --paper-deep: #ecd9b7;
  --ink: #262117;
  --ink-soft: #57493a;
  --brass: #d4a574;
  --brass-deep: #a9743c;
  --line: rgba(38, 33, 23, 0.22);
  --radius: 4px;
  --serif: "EB Garamond", "Crimson Text", "Songti SC", "Noto Serif SC", Georgia, "Times New Roman", serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.78;
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: -15% -10%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.8;
  background:
    radial-gradient(30rem 20rem at 18% 12%, rgba(212, 165, 116, 0.55), transparent 62%),
    radial-gradient(26rem 18rem at 82% 44%, rgba(169, 116, 60, 0.4), transparent 66%),
    radial-gradient(24rem 22rem at 38% 88%, rgba(212, 165, 116, 0.45), transparent 68%);
  filter: blur(16px) saturate(0.92);
  animation: leak 28s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0.26;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='0.5'/%3E%3C/svg%3E");
}

@keyframes leak {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-3%, 2.5%, 0) scale(1.07); }
}

@keyframes vhs {
  0%, 91%, 100% { transform: none; }
  92% { transform: translateX(-2px) skewX(-9deg); }
  94% { transform: translateX(2px) skewX(7deg); }
  96% { transform: translateX(-1px) skewX(-4deg); }
  98% { transform: translateX(1px) skewX(2deg); }
}

a {
  color: var(--brass-deep);
}

/* ---------- 页头 ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(245, 230, 200, 0.94);
  backdrop-filter: blur(10px) saturate(0.9);
  border-bottom: 1px solid var(--line);
}

.ticker {
  margin: 0;
  background: var(--ink);
  color: var(--brass);
  font-size: 12px;
  letter-spacing: 0.36em;
  text-align: center;
  padding: 7px 1rem 6px;
  text-indent: 0.36em;
}

.ticker span {
  display: inline-block;
  animation: vhs 8s steps(1) infinite;
}

.brand-row {
  display: flex;
  justify-content: center;
  padding: 14px 1rem 9px;
  transition: padding 0.3s ease;
}

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

.brand-img {
  width: 26px;
  height: 26px;
  border-radius: 2px;
}

.brand-mark {
  width: 25px;
  height: 17px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background-image:
    repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px);
  background-size: 100% 3px, 100% 3px;
  background-position: 0 2px, 0 calc(100% - 2px);
  background-repeat: no-repeat;
}

.brand-name {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.16em;
  transition: font-size 0.3s ease;
}

.site-head.is-tight .brand-row {
  padding: 5px 1rem 3px;
}

.site-head.is-tight .brand-name {
  font-size: 20px;
}

.main-nav {
  border-top: 1px solid var(--line);
}

.nav-list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.3rem;
  margin: 0 auto;
  padding: 0.15rem 1.25rem;
  max-width: 1120px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 46px;
  padding: 0 0.2rem;
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  border-bottom-color: var(--brass-deep);
  color: var(--brass-deep);
}

.num {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--brass-deep);
  font-variant-numeric: tabular-nums;
}

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

.site-main {
  position: relative;
  z-index: 1;
}

.hero {
  position: relative;
  min-height: 70vh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 3.5rem 1.25rem 6rem;
  overflow: hidden;
}

.hero h1 {
  margin: 0 0 1.6rem;
  font-size: clamp(2.2rem, 8vw, 5.2rem);
  line-height: 1.08;
  letter-spacing: 0.05em;
  font-weight: 700;
  max-width: 20ch;
}

.hero::after {
  content: "";
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: -1.4rem;
  height: 3.6rem;
  background: linear-gradient(90deg, rgba(212, 165, 116, 0.75), rgba(169, 116, 60, 0.5));
  transform: rotate(-1.4deg);
  pointer-events: none;
}

.hero-fig {
  position: relative;
  margin: 0;
  max-width: 36rem;
  padding: 1.1rem 1.4rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(245, 230, 200, 0.45);
  backdrop-filter: blur(9px);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.hero-fig:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px -14px rgba(38, 33, 23, 0.55);
}

.hero-light {
  position: absolute;
  inset: -60%;
  pointer-events: none;
  background: radial-gradient(circle at 32% 30%, rgba(212, 165, 116, 0.55), transparent 55%);
  animation: leak 18s ease-in-out infinite alternate;
}

.hero-fig figcaption {
  position: relative;
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.shell {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 2.6rem;
  align-items: start;
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4.5rem;
}

/* ---------- 侧栏 ---------- */

.rail {
  position: sticky;
  top: 10.5rem;
  padding: 1rem 0.95rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(245, 230, 200, 0.5);
  backdrop-filter: blur(8px);
  transition: box-shadow 0.35s ease;
}

.rail:hover {
  box-shadow: 0 12px 28px -18px rgba(38, 33, 23, 0.6);
}

.rail-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--ink-soft);
}

.rail hr {
  border: 0;
  height: 1px;
  margin: 0.55rem 0 0.9rem;
  background: linear-gradient(90deg, var(--brass-deep), transparent);
}

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

.rail-list a {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.3rem 0 0.3rem 0.55rem;
  border-left: 2px solid transparent;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.rail-list a:hover,
.rail-list a:focus-visible {
  border-left-color: var(--brass-deep);
  background: rgba(212, 165, 116, 0.24);
}

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

.prose {
  min-width: 0;
}

.prose > article {
  padding: 1.4rem 0 2.4rem;
  border-bottom: 1px dashed var(--line);
  scroll-margin-top: 11rem;
}

.prose > article:last-child {
  border-bottom: 0;
  padding-bottom: 0.5rem;
}

.prose h2,
.prose h3 {
  margin: 1.8rem 0 0.55rem;
  line-height: 1.28;
  letter-spacing: 0.02em;
}

.prose h2 {
  font-size: clamp(1.5rem, 3.4vw, 2rem);
}

.prose h3 {
  font-size: 1.22rem;
}

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

.prose ul,
.prose ol {
  margin: 0 0 1.1rem;
  padding-left: 1.35rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose a {
  color: var(--brass-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose hr {
  border: 0;
  height: 1px;
  margin: 0 0 1.1rem;
  background: linear-gradient(90deg, var(--brass-deep), transparent);
}

.prose img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.prose blockquote {
  margin: 1.3rem 0;
  padding: 0.6rem 0 0.6rem 1.1rem;
  border-left: 3px solid var(--brass);
  color: var(--ink-soft);
  font-style: italic;
}

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

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

.prose strong {
  font-weight: 700;
}

html.js .prose > article {
  transition: opacity 0.65s ease, transform 0.65s ease;
}

html.js .prose > article:not(.in) {
  opacity: 0;
  transform: translateY(16px);
}

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

.site-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  padding: 0.7rem 1.25rem;
  border-top: 2px solid var(--ink);
  background: var(--paper-deep);
}

.foot-brand a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink);
  text-decoration: none;
}

.foot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  color: var(--ink-soft);
  text-decoration: none;
}

.foot-list a:hover,
.foot-list a:focus-visible {
  color: var(--brass-deep);
}

.foot-list .num {
  display: none;
}

.foot-copy {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 15px;
  color: var(--ink-soft);
}

.to-top {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: background 0.2s ease;
}

.to-top:hover {
  background: rgba(212, 165, 116, 0.35);
}

/* ---------- 响应式 ---------- */

@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.6rem;
    padding: 1.9rem 1.1rem 3.5rem;
  }

  .rail {
    position: static;
    top: auto;
  }

  .rail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.1rem 0.6rem;
  }

  .nav-list {
    justify-content: flex-start;
    gap: 1rem;
  }

  .hero {
    min-height: 68vh;
    padding: 2.6rem 1.1rem 5rem;
  }

  .site-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    padding: 0.6rem 1.1rem 1rem;
  }

  .foot-copy {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 17px;
  }

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

  .brand-name {
    font-size: 22px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

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