@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400&family=Playfair+Display:ital@1&display=swap');

:root {
  --paper: #fafaf8;
  --grey: #4a4a4a;
  --ink: #1a1a1a;
  --wash: #f0efe9;
  --wash-2: #e6e4dc;
  --rule: #c9c6bc;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(26, 26, 26, .03) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(26, 26, 26, .022) 0 1px, transparent 1px 5px);
  color: var(--ink);
  font-family: Inter, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.68;
  overflow-x: hidden;
}

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

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

/* ---------- 角落品牌 ---------- */
.mark {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 70;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  text-decoration: none;
  transform: rotate(-7deg);
  box-shadow: 3px 3px 0 rgba(26, 26, 26, .18);
  transition: transform .16s steps(2);
}

.mark:hover { transform: rotate(5deg) scale(1.04); }

.mark-img { width: 46px; height: 46px; object-fit: cover; border-radius: 50%; }

.mark-tx { font-size: 19px; font-weight: 800; letter-spacing: .02em; }

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-start;
  padding: 17vh 20px 130px;
  overflow: hidden;
  background: var(--paper);
  clip-path: polygon(0 0, 100% 0, 100% 86%, 0 100%);
}

.hero-art { position: absolute; inset: 0; z-index: 0; }

.hero-art .hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.16) brightness(1.03);
  opacity: .88;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(102deg, rgba(250, 250, 248, .96) 0%, rgba(250, 250, 248, .84) 40%, rgba(250, 250, 248, .2) 100%);
}

.hero-in { position: relative; z-index: 2; max-width: 860px; }

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 7.6vw, 88px);
  line-height: 1.03;
  letter-spacing: -.022em;
  font-weight: 800;
  transform: rotate(-.7deg);
  text-wrap: balance;
}

/* ---------- 主体骨架 ---------- */
main { padding: 0 20px 40px; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-top: 38px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

@media (min-width: 900px) {
  .wrap {
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 44px;
    align-items: start;
  }
}

/* ---------- 侧栏 ---------- */
.rail {
  background: var(--wash-2);
  border-radius: 10px;
  padding: 18px 16px 12px;
  transform: rotate(-.5deg);
  box-shadow: 5px 5px 0 rgba(26, 26, 26, .1);
}

@media (min-width: 900px) {
  .rail { position: sticky; top: 24px; }
}

.rail-h {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.012em;
}

.subtitle {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--grey);
}

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

.rail-list li + li { border-top: 1px dashed var(--rule); }

.rail-list a {
  display: block;
  min-height: 44px;
  padding: 12px 4px;
  font-size: 16px;
  line-height: 1.35;
  text-decoration: none;
}

.rail-list a:hover { background: rgba(26, 26, 26, .07); }

/* ---------- 正文 ---------- */
.body { min-width: 0; }

.prose { font-size: 17px; }

.prose > article {
  background: var(--wash);
  border-radius: 10px;
  padding: 26px 20px 28px;
  margin: 0 0 26px;
  box-shadow: 4px 4px 0 rgba(26, 26, 26, .07);
  scroll-margin-top: 30px;
  scroll-margin-bottom: 116px;
}

.prose > article:nth-child(even) {
  background: var(--wash-2);
  box-shadow: -4px 4px 0 rgba(26, 26, 26, .07);
}

.prose h2 {
  margin: 0 0 6px;
  font-size: clamp(21px, 3.2vw, 30px);
  line-height: 1.22;
  font-weight: 800;
  letter-spacing: -.014em;
}

.prose h2::after {
  content: "";
  display: block;
  width: 68px;
  height: 3px;
  margin: 11px 0 14px;
  background: var(--ink);
  transform: rotate(-1.3deg);
}

.prose h3 { margin: 22px 0 8px; font-size: 19px; font-weight: 700; }

.prose p { margin: 0 0 14px; }

.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }

.prose li { margin: 0 0 8px; }

.prose a {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
}

.prose a:hover { background: var(--ink); color: var(--paper); text-decoration-color: transparent; }

.prose blockquote {
  margin: 0 0 14px;
  padding: 4px 0 4px 16px;
  border-left: 4px solid var(--ink);
  color: var(--grey);
}

.prose img { border-radius: 10px; filter: grayscale(1) contrast(1.05); }

.prose time {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 14px;
  color: var(--grey);
}

.prose figure { margin: 0 0 14px; }

.prose figcaption { font-size: 14px; color: var(--grey); margin-top: 6px; }

.prose code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 15px;
  background: rgba(26, 26, 26, .08);
  padding: 1px 5px;
  border-radius: 4px;
}

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

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

.prose hr { border: 0; border-top: 1px dashed var(--rule); margin: 22px 0; }

/* ---------- 页脚 ---------- */
.foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 20px 118px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.foot-cta {
  margin: 0;
  padding-top: 14px;
  border-top: 3px solid var(--ink);
  font-family: "Playfair Display", Georgia, "Songti SC", serif;
  font-weight: 700;
  font-size: clamp(38px, 9.6vw, 100px);
  line-height: 1;
  letter-spacing: -.02em;
  transform: rotate(-1deg);
}

@media (min-width: 700px) {
  .foot { grid-template-columns: 1fr auto; align-items: end; }
  .foot-cta { grid-column: 1 / -1; }
  .foot-links { justify-self: start; }
  .foot-copy { justify-self: end; }
}

.foot-links { margin: 0; display: flex; flex-wrap: wrap; gap: 2px; }

.foot-links a {
  display: block;
  min-height: 44px;
  padding: 11px 10px;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

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

.foot-copy {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 14px;
  color: var(--grey);
  padding: 11px 0;
}

/* ---------- 底部固定条 ---------- */
.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  border-top: 3px solid var(--ink);
  box-shadow: 0 -6px 0 rgba(26, 26, 26, .08);
}

.bar-btn {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: none;
  border: 0;
  color: var(--paper);
  font: inherit;
  font-size: 16px;
  letter-spacing: .22em;
  cursor: pointer;
}

.bar-btn::before {
  content: "";
  width: 15px;
  height: 2px;
  background: var(--paper);
  box-shadow: 0 5px 0 var(--paper), 0 -5px 0 var(--paper);
}

.nav { display: none; padding: 4px 12px 12px; border-top: 1px dashed #3a3a3a; }

.bar.open .nav { display: block; }

.nav .grp { margin: 0; padding: 2px 0 8px; display: flex; flex-wrap: wrap; }

.nav .grp + .grp { border-top: 1px dashed #3a3a3a; }

.nav .grp::before {
  display: block;
  width: 100%;
  padding: 7px 2px 0;
  font-size: 12px;
  letter-spacing: .26em;
  color: #9d9d96;
  content: "";
}

.nav .grp:nth-child(1)::before { content: "入门"; }
.nav .grp:nth-child(2)::before { content: "判断"; }
.nav .grp:nth-child(3)::before { content: "动手"; }

.nav a {
  display: block;
  min-height: 44px;
  padding: 12px 10px;
  font-size: 16px;
  line-height: 1.35;
  color: var(--paper);
  text-decoration: none;
  border-radius: 6px;
}

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

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

  .nav {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0;
    border: 0;
  }

  .nav .grp { padding: 0; align-items: center; }

  .nav .grp::before { width: auto; padding: 0 4px 0 14px; line-height: 50px; }

  .nav .grp + .grp { border-top: 0; border-left: 1px dashed #3a3a3a; }

  .nav a {
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: 0 12px;
    border-radius: 0;
  }
}

/* ---------- 滚动显影 ---------- */
.rv { opacity: 0; transform: translateY(14px); }

.rv.in {
  opacity: 1;
  transform: none;
  transition: opacity .3s steps(3), transform .3s steps(3);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  .mark { transition: none; }
}

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