@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@400;700&family=Patrick+Hand&display=swap');

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

:root {
  --ink: #192617;
  --ink2: #22321f;
  --ink3: #2c4029;
  --green: #87ff71;
  --yellow: #ffce5c;
  --paper: #eef7e7;
  --line: rgba(135, 255, 113, .3);
  --hand: 'Kalam', 'Patrick Hand', "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --body: 'Patrick Hand', "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --dock: 68px;
}

html {
  scroll-behavior: smooth;
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--paper);
  background-color: var(--ink);
  background-image: radial-gradient(rgba(135, 255, 113, .13) 1px, transparent 1px);
  background-size: 20px 20px;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
menu { margin: 0; padding: 0; list-style: none; }
a { color: var(--green); }

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

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 顶部：文在上、图在下的紧凑开场 */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  min-height: 45vh;
  padding: clamp(22px, 5vw, 42px) clamp(16px, 5vw, 48px) 18px;
  text-align: right;
  border-bottom: 6px solid var(--green);
}

.hero-copy { width: 100%; max-width: 920px; }

h1 {
  font-family: var(--hand);
  font-size: clamp(1.9rem, 7vw, 3.5rem);
  line-height: 1.14;
  letter-spacing: .02em;
  margin: 0;
  color: var(--green);
  text-shadow: 4px 4px 0 rgba(255, 206, 92, .5);
}

.hero-art { width: min(100%, 640px); will-change: transform; }

.hero-img {
  width: 100%;
  height: clamp(150px, 26vh, 235px);
  object-fit: cover;
  border-bottom: 5px solid var(--yellow);
  clip-path: polygon(0 5%, 100% 0, 100% 92%, 0 100%);
}

/* 正文与右栏 */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 258px;
  gap: clamp(18px, 3vw, 36px);
  align-items: start;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 44px) clamp(16px, 5vw, 48px) clamp(40px, 6vw, 70px);
}

.doc { min-width: 0; }

.doc > section {
  background: rgba(255, 255, 255, .04);
  border: 1px dashed var(--line);
  border-bottom: 5px solid var(--yellow);
  padding: clamp(16px, 3vw, 26px) clamp(14px, 3vw, 22px);
  margin: 0 0 clamp(18px, 3vw, 28px);
  scroll-margin-top: 18px;
}

.doc > section:nth-child(odd) { transform: rotate(-.35deg); }
.doc > section:nth-child(even) { transform: rotate(.35deg); }

.doc h2 {
  font-family: var(--hand);
  font-size: clamp(1.35rem, 4.2vw, 1.95rem);
  line-height: 1.25;
  margin: 0 0 .6em;
  color: var(--yellow);
}

.doc h2 > span {
  background: linear-gradient(transparent 60%, rgba(135, 255, 113, .42) 60%);
  padding: 0 2px;
}

.doc h3 {
  font-family: var(--hand);
  font-size: 1.18rem;
  line-height: 1.3;
  color: var(--green);
  margin: 1.3em 0 .45em;
}

.doc h3 > span { border-bottom: 3px dotted var(--yellow); }

.doc p { margin: 0 0 1em; }
.doc ul, .doc ol { margin: 0 0 1em; padding-left: 1.3em; }
.doc li { margin: .3em 0; }

.doc a {
  color: var(--green);
  text-decoration: underline dashed;
  text-underline-offset: 3px;
}

.doc blockquote {
  margin: 0 0 1.1em;
  padding: 10px 15px;
  border-left: 5px solid var(--green);
  background: rgba(135, 255, 113, .08);
  transform: rotate(-.5deg);
}

.doc code {
  font-size: .95em;
  background: rgba(255, 206, 92, .18);
  padding: 1px 5px;
}

.doc img { width: 100%; margin: 0 0 1em; border-bottom: 4px solid var(--yellow); }

.doc table { width: 100%; display: block; overflow-x: auto; border-collapse: collapse; margin: 0 0 1em; }
.doc th, .doc td { border: 1px dashed var(--line); padding: 8px 10px; text-align: left; }

/* 右栏 */
.rail {
  position: sticky;
  top: 18px;
  background: var(--ink2);
  border: 2px solid var(--green);
  padding: 14px 14px 18px;
  clip-path: polygon(0 0, 100% 0, 100% 94%, 90% 100%, 0 100%);
  overflow: hidden;
}

.spin {
  display: block;
  width: 42px; height: 42px;
  margin: 0 0 10px;
  background: var(--yellow);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  animation: turn 9s linear infinite;
}

@keyframes turn { to { transform: rotate(360deg); } }

.rail-h {
  font-family: var(--hand);
  font-size: 1.05rem;
  letter-spacing: .12em;
  color: var(--green);
  margin: 0 0 8px;
}

.rail-h > span { border-bottom: 3px solid var(--yellow); padding-bottom: 2px; }

.rail-list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 2px;
  font-size: 16px;
  color: var(--paper);
  text-decoration: none;
  border-bottom: 1px dotted rgba(255, 206, 92, .45);
}

.rail-list a:hover { color: var(--green); }

/* 底部固定条 */
.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--ink2);
  border-top: 3px solid var(--green);
  box-shadow: 0 -5px 0 rgba(255, 206, 92, .9);
}

.dock-pair { display: flex; justify-content: flex-start; }

.dock a,
.dock summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 9px;
  font-size: 16px;
  color: var(--paper);
  text-decoration: none;
}

.dock a:hover, .dock summary:hover { color: var(--green); }

.dock-brand {
  font-family: var(--hand);
  font-size: 1.15rem;
  line-height: 1;
  color: var(--green) !important;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

.dock-fold { justify-self: end; position: relative; }

.dock-fold > summary {
  cursor: pointer;
  list-style: none;
  border: 2px dashed var(--green);
  padding: 4px 10px;
}

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

.fold-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(76vw, 272px);
  padding: 10px;
  background: var(--ink3);
  border: 2px solid var(--green);
  box-shadow: 6px 6px 0 rgba(255, 206, 92, .85);
}

.fold-search { display: flex; gap: 8px; margin: 0 0 8px; }

.fold-search input,
.sub input {
  flex: 1 1 110px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 10px;
  font: inherit;
  font-size: 16px;
  color: var(--paper);
  background: var(--ink);
  border: 2px dashed var(--green);
  border-radius: 0;
}

.fold-search button,
.sub button {
  min-height: 44px;
  padding: 6px 14px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  background: var(--yellow);
  border: 0;
  border-radius: 0;
  cursor: pointer;
}

.fold-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 6px;
  color: var(--paper);
  text-decoration: none;
  border-bottom: 1px dotted rgba(135, 255, 113, .4);
}

.fold-list a:hover { color: var(--green); }

/* 页脚 */
.foot {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: clamp(16px, 3vw, 34px);
  align-items: start;
  padding: clamp(24px, 4vw, 38px) clamp(16px, 5vw, 48px) calc(var(--dock) + 34px);
  background: var(--ink2);
  border-top: 6px solid var(--yellow);
}

.foot-logo {
  display: inline-block;
  padding: 6px 0;
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--green);
  text-decoration: none;
}

.foot-intro {
  margin: 8px 0 0;
  max-width: 34ch;
  font-size: 16px;
  color: rgba(238, 247, 231, .78);
}

.foot-h {
  margin: 0 0 8px;
  font-family: var(--hand);
  font-size: 1rem;
  letter-spacing: .12em;
  color: var(--yellow);
}

.foot-h > span { border-bottom: 3px dotted var(--green); padding-bottom: 2px; }

.foot-list { display: flex; flex-wrap: wrap; gap: 0 14px; }

.foot-list a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 0;
  font-size: 16px;
  color: var(--paper);
  text-decoration: none;
}

.foot-list a:hover { color: var(--green); text-decoration: underline dashed; }

.sub { display: flex; flex-wrap: wrap; gap: 8px; }

.copy {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  padding-top: 12px;
  font-size: 16px;
  color: rgba(238, 247, 231, .7);
  border-top: 2px dotted rgba(135, 255, 113, .35);
}

@media (max-width: 880px) {
  main { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; order: 2; }
  .foot { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .foot { grid-template-columns: 1fr; }
  .dock-brand { font-size: 1rem; }
  .dock a, .dock summary { padding: 4px 7px; }
  .doc > section { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spin { animation: none; }
  .doc > section { transform: none; }
  .hero-art { transform: none !important; }
}

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