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

:root {
  --paper: #fdfbf7;
  --ash: #f5f5f5;
  --ink: #1a1a1a;
  --line: #e0e0e0;
  --dim: #5c5a56;
  --sans: 'Space Grotesk', 'Archivo', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --serif: Georgia, 'Songti SC', 'SimSun', 'Noto Serif SC', serif;
  --pad: clamp(1rem, 4vw, 2.5rem);
}

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

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

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.75;
  overflow-wrap: break-word;
  transition: none;
}

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

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

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

/* ---------- 页头 ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.2rem 1.6rem;
  max-width: 100%;
  padding: 0.45rem var(--pad);
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  max-width: 100%;
  padding: 0.5rem 0.15rem;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.tabs {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.tabs p {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0 0.1rem;
  min-width: 0;
  max-width: 100%;
  margin: 0;
}

.tabs a {
  display: inline-block;
  min-height: 40px;
  padding: 0.55rem 0.5rem;
  font-family: var(--sans);
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.tabs a:hover,
.tabs a.on {
  border-bottom-color: var(--ink);
}

/* ---------- 主体骨架 ---------- */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  align-items: start;
  gap: 2.4rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(1rem, 3.5vw, 2.4rem) var(--pad) 2.6rem;
}

.hero {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 13px 13px;
}

.hero h1 {
  max-width: 24ch;
  margin: 0.3rem 0 0;
  font-family: var(--sans);
  font-size: clamp(1.9rem, 5.4vw, 3.2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.collage {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 0.7rem;
  width: 100%;
  min-height: clamp(130px, 24vh, 210px);
  margin: 1.4rem 0 0;
}

.collage .shot {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  max-height: 230px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--ash);
}

.shot-b {
  transform: translateY(0.9rem);
}

.content {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  max-width: 100%;
}

section[id] {
  scroll-margin-top: 7rem;
}

/* ---------- 正文 ---------- */
.content section {
  min-width: 0;
  max-width: 100%;
  margin: 0 0 1rem;
  padding: 1.4rem 1.25rem;
  background: var(--ash);
  border-radius: 4px;
}

.content h2 {
  margin: 0.1rem 0 0;
  font-family: var(--sans);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.content h3 {
  margin: 1.5rem 0 0.5rem;
  font-family: var(--sans);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.4;
}

.content h2 + hr,
.content h3 + hr {
  width: 2.4rem;
  margin: 0.7rem 0 1.1rem;
  border: 0;
  border-top: 2px solid var(--ink);
}

.content p {
  margin: 0 0 1em;
  overflow-wrap: anywhere;
}

.content p:last-child {
  margin-bottom: 0;
}

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

.content li {
  margin: 0.28rem 0;
  overflow-wrap: anywhere;
}

.content a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.content strong {
  font-weight: 700;
}

.content blockquote {
  margin: 1.2rem 0;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 3px solid var(--ink);
  font-style: italic;
}

.content figure {
  max-width: 100%;
  margin: 1.2rem 0;
}

.content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.content figcaption {
  margin-top: 0.5rem;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--dim);
}

.content hr {
  margin: 1.4rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.content table {
  display: block;
  max-width: 100%;
  margin: 0 0 1em;
  overflow-x: auto;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 1rem;
}

.content th,
.content td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

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

.content pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 0.8rem;
  background: var(--paper);
  border-radius: 4px;
}

/* ---------- 右侧栏 ---------- */
.rail {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: sticky;
  top: 5.4rem;
  min-width: 0;
  padding-left: 1.1rem;
  border-left: 1px solid var(--line);
  font-family: var(--sans);
}

.rail h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.rail hr {
  width: 2.2rem;
  margin: 0.55rem 0 0.9rem;
  border: 0;
  border-top: 1px solid var(--ink);
}

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

.rail li {
  counter-increment: rail;
  break-inside: avoid;
}

.rail li a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0.35rem 0;
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.rail li a::before {
  content: counter(rail, decimal-leading-zero);
  margin-right: 0.6rem;
  font-size: 0.8rem;
  color: var(--dim);
}

.rail li a:hover,
.rail li a.on {
  border-bottom-color: var(--ink);
}

.rail-top {
  margin: 1.1rem 0 0;
}

.rail-top a {
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
}

/* ---------- 页脚 ---------- */
.site-foot {
  margin-top: 1.6rem;
  padding: 2.2rem var(--pad) 1.4rem;
  background: var(--ash);
  border-top: 1px solid var(--ink);
}

.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.4rem;
  max-width: 1120px;
  margin: 0 auto;
}

.foot-col {
  min-width: 0;
}

address {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-style: normal;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sub {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: 100%;
}

.sub input {
  flex: 1 1 8rem;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
}

.sub button {
  min-height: 40px;
  padding: 0.45rem 1.05rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 1rem;
  cursor: pointer;
}

.foot-col ul {
  display: grid;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--sans);
}

.foot-col li a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.3rem 0;
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.foot-col li a:hover {
  border-bottom-color: var(--ink);
}

.foot-bottom {
  max-width: 1120px;
  margin: 1.6rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  text-align: center;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--dim);
}

.foot-bottom p {
  margin: 0;
}

/* ---------- 动效 ---------- */
@media (prefers-reduced-motion: no-preference) {
  .rail li {
    animation: rail-in 0.16s steps(3) both;
  }

  .rail li:nth-child(2) { animation-delay: 0.02s; }
  .rail li:nth-child(3) { animation-delay: 0.04s; }
  .rail li:nth-child(4) { animation-delay: 0.06s; }
  .rail li:nth-child(5) { animation-delay: 0.08s; }
  .rail li:nth-child(6) { animation-delay: 0.1s; }
  .rail li:nth-child(7) { animation-delay: 0.12s; }

  .rail li a:hover {
    transform: translateX(3px);
  }
}

@keyframes rail-in {
  from { transform: translateY(-4px); }
  to { transform: translateY(0); }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 860px) {
  .site-head {
    position: static;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-bottom: 0.35rem;
  }

  .tabs p {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0 0.15rem;
    overflow-x: visible;
    padding-bottom: 0.15rem;
  }

  .tabs a {
    padding: 0.55rem 0.4rem;
  }

  main {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.6rem;
  }

  .hero,
  .content,
  .rail {
    grid-column: 1;
    grid-row: auto;
  }

  .rail {
    position: static;
    padding: 1rem 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .rail ol {
    columns: 2;
    column-gap: 1rem;
  }

  .collage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: clamp(110px, 20vh, 180px);
  }

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

  section[id] {
    scroll-margin-top: 1.2rem;
  }
}

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

  .content section {
    padding: 1.2rem 1rem;
  }

  .rail ol {
    columns: 1;
  }

  .tabs a {
    padding: 0.55rem 0.35rem;
  }
}

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