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

:root {
  --paper: #fafaf8;
  --gray: #4a4a4a;
  --ink: #1a1a1a;
  --soft: #f0f0ec;
  --line: rgba(26, 26, 26, 0.85);
  --faint: rgba(26, 26, 26, 0.14);
}

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

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(26, 26, 26, 0.11) 0.8px, transparent 0.9px);
  background-size: 4px 4px;
  color: var(--ink);
  font-family: 'IBM Plex Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  overflow-x: hidden;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(26, 26, 26, 0.045) 0 1px,
    rgba(250, 250, 248, 0) 1px 3px
  );
  opacity: 0.75;
}

a {
  color: var(--ink);
  transition: background-color 90ms steps(2, end), color 90ms linear, transform 110ms steps(2, end);
}

.skip {
  position: absolute;
  left: 12px;
  top: -70px;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
}

.skip:focus {
  top: 10px;
}

/* 顶栏 */
.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px clamp(12px, 4vw, 28px);
  background: rgba(250, 250, 248, 0.95);
  border-bottom: 2px solid var(--ink);
}

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 16px 14px 17px 13px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  transform: rotate(-2deg);
  overflow: hidden;
}

.mark:hover {
  transform: rotate(2deg) translateY(-2px);
}

.mark-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.15);
}

.mark-t {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.menu {
  margin-left: auto;
  position: relative;
}

.menu > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  letter-spacing: 0.06em;
  user-select: none;
}

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

.menu > summary:hover {
  background: var(--gray);
}

.menu > menu {
  list-style: none;
  margin: 0;
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(78vw, 280px);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 22px 26px 20px 28px;
  box-shadow: 6px 6px 0 var(--ink);
  z-index: 50;
}

.menu[open] > menu {
  display: flex;
}

.menu > menu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 500;
  background: rgba(26, 26, 26, 0.06);
}

.menu > menu a:hover,
.menu > menu a:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

.menu > menu li {
  animation: drop 260ms steps(3, end) both;
}

.menu > menu li:nth-child(2) { animation-delay: 30ms; }
.menu > menu li:nth-child(3) { animation-delay: 60ms; }
.menu > menu li:nth-child(4) { animation-delay: 90ms; }
.menu > menu li:nth-child(5) { animation-delay: 120ms; }
.menu > menu li:nth-child(6) { animation-delay: 150ms; }
.menu > menu li:nth-child(7) { animation-delay: 180ms; }

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-5px) rotate(-1.2deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 900px) {
  .menu > summary {
    display: none;
  }
  .menu > menu,
  .menu:not([open]) > menu {
    position: static;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    width: auto;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .menu > menu a {
    background: transparent;
    border: 2px solid transparent;
    font-weight: 500;
    padding: 0 14px;
  }
  .menu > menu a:hover,
  .menu > menu a:focus-visible {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper);
  }
}

/* 主体 */
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(14px, 3vw, 30px) clamp(12px, 4vw, 28px) clamp(36px, 6vw, 60px);
}

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'hero' 'flow' 'side';
  gap: 26px;
  align-items: start;
}

@media (min-width: 900px) {
  .sheet {
    grid-template-columns: minmax(0, 1fr) 296px;
    grid-template-areas: 'hero hero' 'flow side';
    gap: 36px 34px;
  }
}

/* 首屏 */
.hero {
  grid-area: hero;
  position: relative;
  margin: 0;
  min-height: 340px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: clamp(18px, 4vw, 40px);
  border-radius: 28px 22px 30px 24px;
  overflow: hidden;
  background-color: var(--ink);
  background-image: radial-gradient(rgba(250, 250, 248, 0.22) 1px, transparent 1.2px);
  background-size: 11px 11px;
  color: var(--paper);
  transform: rotate(0.25deg);
}

@media (min-width: 900px) {
  .hero {
    min-height: 45vh;
  }
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(205deg, rgba(26, 26, 26, 0.15) 0%, rgba(26, 26, 26, 0.86) 88%);
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.14);
}

.tape {
  position: absolute;
  left: 16px;
  top: 16px;
  width: 76px;
  height: 24px;
  background: rgba(250, 250, 248, 0.5);
  border: 1px dashed rgba(26, 26, 26, 0.7);
  transform: rotate(-7deg);
  z-index: 3;
}

.hero-box {
  position: relative;
  z-index: 2;
  text-align: right;
  max-width: 36ch;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.85rem, 5.4vw, 3.3rem);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.lede {
  margin: 0 0 20px;
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(250, 250, 248, 0.85);
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.cta:hover {
  transform: translate(-3px, -3px) rotate(-1.4deg);
  background: var(--paper);
}

/* 正文 */
.flow {
  grid-area: flow;
  min-width: 0;
  max-width: 72ch;
}

.flow div {
  scroll-margin-top: 96px;
  padding: 6px 0 26px;
  border-bottom: 2px dashed var(--faint);
  margin-bottom: 26px;
}

.flow div:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

.flow h2 {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 3.2vw, 1.9rem);
  line-height: 1.32;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.flow h3 {
  margin: 26px 0 8px;
  font-size: 1.14rem;
  line-height: 1.45;
  font-weight: 600;
}

.flow p {
  margin: 0 0 16px;
}

.flow ul,
.flow ol {
  margin: 0 0 18px;
  padding-left: 1.3em;
}

.flow li {
  margin-bottom: 8px;
}

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

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

.flow strong {
  font-weight: 600;
}

.flow blockquote {
  margin: 0 0 18px;
  padding: 14px 18px;
  background: var(--soft);
  border-radius: 20px 24px 18px 26px;
  color: var(--gray);
}

.flow figure {
  margin: 0 0 18px;
}

.flow img {
  max-width: 100%;
  height: auto;
  border-radius: 22px;
  filter: grayscale(1) contrast(1.06);
}

.flow table {
  display: block;
  overflow-x: auto;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
  margin-bottom: 18px;
}

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

.flow code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--soft);
  padding: 1px 6px;
  border-radius: 8px;
}

/* 侧栏 */
.side {
  grid-area: side;
  background: var(--soft);
  border-radius: 22px 28px 24px 30px;
  padding: 18px 16px 20px;
  transform: rotate(-0.6deg);
}

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

.side h2 {
  margin: 0 0 10px;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

hr {
  border: 0;
  border-top: 2px solid var(--line);
  width: 54px;
  margin: 0 0 14px;
}

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

.toc a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 2px 0;
  font-size: 0.95rem;
  text-decoration: none;
  border-bottom: 1px dashed rgba(26, 26, 26, 0.18);
}

.toc li:last-child a {
  border-bottom: 0;
}

.toc a:hover {
  padding-left: 6px;
  font-weight: 600;
}

.sidedesc {
  margin: 14px 0 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--gray);
}

/* 页脚 */
.foot {
  margin-top: clamp(30px, 6vw, 56px);
  padding: clamp(26px, 5vw, 52px) clamp(14px, 4vw, 34px) 26px;
  background: var(--ink);
  background-image: radial-gradient(rgba(250, 250, 248, 0.10) 0.9px, transparent 1px);
  background-size: 6px 6px;
  color: var(--paper);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 18px;
}

@media (min-width: 760px) {
  .foot {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.mega {
  grid-column: 1 / -1;
  margin: 0;
  font-size: clamp(2.3rem, 10.5vw, 5.8rem);
  line-height: 0.96;
  font-weight: 700;
  letter-spacing: -0.04em;
  transform: rotate(-0.7deg);
}

.col {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.94rem;
  line-height: 1.6;
  color: rgba(250, 250, 248, 0.72);
}

.col a {
  display: flex;
  align-items: center;
  min-height: 40px;
  color: rgba(250, 250, 248, 0.92);
  text-decoration: none;
  border-bottom: 1px solid rgba(250, 250, 248, 0.16);
}

.col a:hover {
  padding-left: 5px;
  color: var(--paper);
}

.legal {
  grid-column: 1 / 2;
  margin: 6px 0 0;
  padding-top: 12px;
  font-size: 0.82rem;
  color: rgba(250, 250, 248, 0.55);
  border-top: 1px solid rgba(250, 250, 248, 0.22);
}

.totop {
  grid-column: 2 / -1;
  justify-self: end;
  margin: 6px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(250, 250, 248, 0.22);
}

.totop a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.totop a:hover {
  transform: translateY(-2px) rotate(-1deg);
}

:focus-visible {
  outline: 2px dashed var(--ink);
  outline-offset: 3px;
}

.foot :focus-visible {
  outline-color: var(--paper);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 16px;
  }
  .hero {
    min-height: 320px;
  }
}

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