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

:root {
  --paper: #fafaf8;
  --ink: #1a1a1a;
  --gray: #4a4a4a;
  --faint: #8a8a86;
  --edge: rgba(26, 26, 26, 0.3);
  --mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding-bottom: 104px;
  font: 400 17px/1.75 var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(180deg, rgba(26, 26, 26, 0.035) 0, rgba(26, 26, 26, 0.035) 1px, transparent 1px, transparent 5px),
    radial-gradient(120% 78% at 10% 0%, rgba(74, 74, 74, 0.07), transparent 62%),
    radial-gradient(90% 60% at 92% 88%, rgba(26, 26, 26, 0.05), transparent 58%);
  overflow-x: clip;
}

img {
  max-width: 100%;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 99;
  padding: 0.65rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font: 500 16px/1.4 var(--sans);
  text-decoration: none;
}

.skip:focus {
  left: 8px;
  top: 8px;
}

/* ---------- 底部工具条 ---------- */

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem clamp(0.55rem, 2vw, 1.1rem);
  background: var(--paper);
  border-top: 2px solid var(--ink);
}

.dock-mark {
  order: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.3rem;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  transform: rotate(-1.4deg);
  background: #fff;
  flex: 0 0 auto;
}

.mark-img {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.mark-txt {
  font: 600 15px/1 var(--mono);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.dock-search {
  order: 2;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1 1 auto;
  min-width: 0;
}

.dock-search input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 0 0.6rem;
  font: 400 16px/1.4 var(--sans);
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

.dock-search input::placeholder {
  color: var(--faint);
}

.dock-search button {
  min-height: 44px;
  padding: 0 0.75rem;
  font: 600 16px/1 var(--sans);
  color: var(--paper);
  background: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
}

.dock-menu {
  order: 3;
  position: relative;
  flex: 0 0 auto;
}

.dock-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 0.7rem;
  font: 600 16px/1 var(--sans);
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--ink);
  cursor: pointer;
  transform: rotate(0.8deg);
}

.dock-menu summary::-webkit-details-marker {
  display: none;
}

.dock-menu summary::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
}

.dock-menu[open] summary {
  background: var(--ink);
  color: var(--paper);
}

.dock-menu[open] summary::after {
  transform: rotate(180deg);
}

.dock-menu menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(80vw, 250px);
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--paper);
  border: 2px solid var(--ink);
  transform: rotate(0.7deg);
}

.dock-menu menu li + li {
  border-top: 1px dashed var(--edge);
}

.dock-menu menu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 0.5rem;
  font: 400 16px/1.35 var(--sans);
  color: var(--ink);
  text-decoration: none;
}

.dock-menu menu a:hover {
  background: #eeeeea;
}

.dock-top {
  order: 4;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.55rem;
  font: 500 16px/1 var(--sans);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ---------- 骨架 ---------- */

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.1rem, 2.6vw, 2.2rem);
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.2rem clamp(0.85rem, 3vw, 2rem) 3rem;
}

/* ---------- 头图 ---------- */

.hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "h1 h1"
    "a b";
  gap: 1rem 1.1rem;
  align-content: center;
  padding: 1.4rem 0 1rem;
}

.hero-h1 {
  grid-area: h1;
  margin: 0;
  font: 600 clamp(2rem, 7.4vw, 4.1rem)/1.04 var(--mono);
  letter-spacing: -0.035em;
  transform: rotate(-0.8deg);
  max-width: 22ch;
}

.plate {
  position: relative;
  margin: 0;
  padding: 7px;
  background: #fff;
  border: 1.5px solid var(--ink);
  transform: rotate(var(--rot, -1.4deg)) translateY(var(--py, 0px));
}

.plate::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 62px;
  height: 17px;
  margin-left: -31px;
  background: rgba(26, 26, 26, 0.13);
  border: 1px solid rgba(26, 26, 26, 0.18);
  transform: rotate(-3.5deg);
}

.plate-a {
  grid-area: a;
  --rot: -2.6deg;
  justify-self: start;
  z-index: 2;
}

.plate-b {
  grid-area: b;
  --rot: 2.1deg;
  justify-self: end;
  align-self: end;
  margin-top: 2.4rem;
  width: min(86%, 300px);
  z-index: 1;
}

.plate-img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(1) contrast(1.08);
}

.plate-blank {
  display: block;
  aspect-ratio: 4 / 3;
  background: repeating-linear-gradient(45deg, #ffffff 0 10px, #f2f2ee 10px 20px);
}

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

.rail {
  display: grid;
  gap: 1.1rem;
  align-content: start;
}

.rail-block {
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1.5px solid var(--ink);
  transform: rotate(-0.5deg);
}

.rail-block + .rail-block {
  transform: rotate(0.6deg);
}

.rail-h2 {
  margin: 0 0 0.35rem;
  font: 600 19px/1.3 var(--sans);
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 0;
  font: 400 16px/1.6 var(--sans);
  color: var(--gray);
}

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

.rail-list a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.4rem 0.1rem;
  font: 500 16px/1.4 var(--sans);
  color: var(--gray);
  text-decoration: none;
  border-bottom: 1px dashed var(--edge);
}

.rail-list a::before {
  content: "";
  width: 9px;
  height: 2px;
  background: currentColor;
  flex: 0 0 auto;
}

.rail-list a.on {
  color: var(--ink);
  font-weight: 600;
}

.rail-list a.on::before {
  height: 4px;
}

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

.prose {
  min-width: 0;
  max-width: 74ch;
}

.prose > div {
  scroll-margin-top: 1.6rem;
}

.prose > div + div {
  margin-top: 2.2rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--edge);
}

.prose :where(h2) {
  margin: 2.1rem 0 0.55rem;
  padding-bottom: 0.35rem;
  font: 600 clamp(1.35rem, 3.6vw, 1.85rem)/1.3 var(--mono);
  letter-spacing: -0.025em;
  border-bottom: 2px solid var(--ink);
}

.prose > div:first-child h2:first-child {
  margin-top: 0.4rem;
}

.prose :where(h3) {
  margin: 1.6rem 0 0.4rem;
  font: 600 1.15rem/1.45 var(--sans);
}

.prose :where(p) {
  margin: 0 0 1.05rem;
}

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

.prose :where(li) {
  margin: 0.3rem 0;
}

.prose :where(li)::marker {
  color: var(--gray);
}

.prose :where(a) {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.prose :where(img) {
  height: auto;
  padding: 5px;
  background: #fff;
  border: 1.5px solid var(--ink);
}

.prose :where(figure) {
  margin: 1.2rem 0;
}

.prose :where(figcaption) {
  font: 400 16px/1.5 var(--sans);
  color: var(--gray);
  padding-top: 0.35rem;
}

.prose :where(blockquote) {
  margin: 1.2rem 0;
  padding: 0.6rem 1rem;
  color: var(--gray);
  background: #fff;
  border-left: 4px solid var(--ink);
}

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

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

.prose :where(code) {
  font: 400 15px/1.5 var(--mono);
  background: #efefeb;
  padding: 0.1em 0.3em;
}

.prose div.flash {
  animation: flash 0.7s steps(2) 2;
}

@keyframes flash {
  0% {
    outline: 3px dashed var(--ink);
    outline-offset: 7px;
  }
  100% {
    outline: 3px dashed transparent;
    outline-offset: 7px;
  }
}

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

.foot {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  margin-top: 2.4rem;
  padding: 2rem clamp(0.85rem, 3vw, 2rem) 1.4rem;
  border-top: 2px solid var(--ink);
  background: #f1f1ec;
}

.foot-mark {
  margin: 0 0 0.5rem;
  font: 700 clamp(2.3rem, 11vw, 5.2rem)/0.94 var(--mono);
  letter-spacing: -0.055em;
  transform: rotate(-1.2deg);
  transform-origin: left center;
}

.foot-map ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.9rem;
}

.foot-map a {
  display: flex;
  align-items: center;
  min-height: 42px;
  font: 400 16px/1.4 var(--sans);
  color: var(--gray);
  text-decoration: none;
  border-bottom: 1px dashed var(--edge);
}

.foot-map a:hover {
  color: var(--ink);
}

.foot-fine {
  grid-column: 1 / -1;
  margin-top: 0.3rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--edge);
}

.copy {
  margin: 0;
  font: 400 16px/1.5 var(--sans);
  color: var(--gray);
}

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

@media (min-width: 760px) {
  .hero {
    grid-template-columns: 1.12fr 0.88fr;
    grid-template-areas: "h1 a";
    align-items: center;
    min-height: 70vh;
    padding: 2rem 0 2.4rem;
    gap: 2rem;
  }

  .hero-h1 {
    grid-area: h1;
  }

  .plate {
    grid-area: a;
  }

  .plate-a {
    width: min(100%, 340px);
    align-self: start;
    justify-self: start;
  }

  .plate-b {
    width: min(72%, 280px);
    margin-top: 0;
    align-self: end;
    justify-self: end;
  }
}

@media (min-width: 900px) {
  .shell {
    grid-template-columns: 236px minmax(0, 1fr);
    column-gap: clamp(1.6rem, 4vw, 3.5rem);
  }

  .rail {
    position: sticky;
    top: 1.2rem;
  }

  .foot {
    grid-template-columns: 1.35fr 0.65fr;
    align-items: start;
  }
}

@media (max-width: 420px) {
  body {
    padding-bottom: 108px;
  }

  .dock {
    gap: 0.35rem;
  }

  .dock-top {
    padding: 0 0.4rem;
    font-size: 15px;
  }

  .dock-search button {
    padding: 0 0.55rem;
  }
}

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

  * {
    animation: none !important;
    transition: none !important;
  }

  .plate {
    transform: rotate(var(--rot, 0deg));
  }
}

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