@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 {
  --ink: #172623;
  --ink-soft: #35463f;
  --mint: #5cc6b0;
  --mint-deep: #3a9c8a;
  --sand: #d4c4a8;
  --sand-soft: #e7ddca;
  --clay: #b06b4a;
  --olive: #6b7b3c;
  --paper: #f7f2e8;
  --paper-2: #efe6d5;
  --paper-3: #e5d8c1;
  --line: rgba(23, 38, 35, 0.16);
  --radius: 10px;
  --maxw: 1180px;
  --shadow: 0 16px 32px -20px rgba(23, 38, 35, 0.55);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*,
*::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(120% 70% at 8% 0%, #f2e8d8 0%, transparent 58%),
    radial-gradient(100% 60% at 92% 8%, #ece1cd 0%, transparent 55%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Fira Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  font-weight: 400;
  text-rendering: optimizeLegibility;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0.17;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)' opacity='0.5'/%3E%3C/svg%3E");
}

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

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--mint-deep);
  outline-offset: 3px;
}

/* ---------- 顶部细条 ---------- */

.strip {
  margin: 0;
  padding: 8px clamp(14px, 4vw, 32px);
  background: var(--ink);
  color: var(--sand);
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.05em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 页头 ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px clamp(12px, 3vw, 32px);
  background: rgba(247, 242, 232, 0.93);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.rail {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.rail-a {
  justify-self: start;
}

.rail-b {
  justify-self: end;
}

.rail a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.28s var(--ease), color 0.28s var(--ease);
}

.rail a:hover {
  background: var(--sand-soft);
  color: var(--ink);
}

.mark {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--mint) 0%, #8ed8c7 60%, var(--sand) 100%);
  color: var(--ink);
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 8px 16px -12px rgba(23, 38, 35, 0.8);
  transition: transform 0.3s var(--ease);
}

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

.mark-logo {
  display: block;
  max-height: 30px;
  width: auto;
}

.burger {
  justify-self: end;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--mint);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.24s var(--ease), background 0.24s var(--ease);
}

.burger:hover {
  transform: translateY(-2px);
  background: var(--sand);
}

/* ---------- 全屏遮罩菜单 ---------- */

.veil {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 64px 16px 32px;
  background: var(--ink);
  background-image:
    radial-gradient(80% 60% at 20% 10%, rgba(92, 198, 176, 0.16) 0%, transparent 60%),
    radial-gradient(70% 60% at 85% 90%, rgba(212, 196, 168, 0.16) 0%, transparent 60%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s var(--ease), visibility 0.32s var(--ease);
}

.veil.open {
  opacity: 1;
  visibility: visible;
}

.veil-in {
  width: min(88vw, 540px);
  max-height: 100%;
  overflow-y: auto;
}

.veil-tag {
  margin: 0 0 14px;
  text-align: center;
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 16px;
  letter-spacing: 0.22em;
  color: var(--sand);
}

.veil-nav {
  display: grid;
  gap: 4px;
}

.veil-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 14px;
  border-radius: var(--radius);
  color: var(--sand);
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 18px;
  text-decoration: none;
  transition: background 0.22s var(--ease), color 0.22s var(--ease);
}

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

.veil-close {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(212, 196, 168, 0.55);
  border-radius: 999px;
  background: transparent;
  color: var(--sand);
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.22s var(--ease), color 0.22s var(--ease);
}

.veil-close:hover {
  background: var(--sand);
  color: var(--ink);
}

/* ---------- 首屏 ---------- */

.hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 45vh;
  padding: clamp(30px, 6vw, 60px) clamp(18px, 6vw, 56px) clamp(38px, 7vw, 74px);
  overflow: hidden;
  background-image:
    radial-gradient(110% 90% at 18% 0%, #f0e3ce 0%, transparent 62%),
    radial-gradient(90% 80% at 86% 24%, #e6dcc2 0%, transparent 58%);
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 16px;
  background: linear-gradient(90deg, var(--mint) 0%, var(--sand) 52%, var(--clay) 100%);
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

.hero-copy {
  position: relative;
  z-index: 3;
  max-width: 660px;
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 6.2vw, 56px);
  line-height: 1.16;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

.plate {
  position: absolute;
  z-index: 2;
  width: clamp(96px, 19vw, 196px);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--paper-3);
  box-shadow: var(--shadow);
  transition: transform 0.5s var(--ease);
}

.plate-a {
  top: 7%;
  left: 2%;
  transform: rotate(-4deg);
}

.plate-b {
  right: 2%;
  bottom: 13%;
  transform: rotate(3deg);
}

.plate:hover {
  transform: rotate(0deg) scale(1.03);
}

.plate-img {
  display: block;
  width: 100%;
  height: auto;
  filter: sepia(0.14) saturate(0.94);
}

/* ---------- 主体骨架 ---------- */

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(22px, 3vw, 38px);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 46px) clamp(14px, 4vw, 34px) clamp(30px, 6vw, 56px);
}

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

.side {
  align-self: start;
  padding: 16px 14px 12px;
  border-radius: var(--radius);
  background: var(--sand-soft);
}

.side small,
.prose small {
  display: block;
  margin-bottom: 2px;
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0.2em;
  color: var(--clay);
}

.side h2 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.side-nav {
  display: grid;
  gap: 2px;
}

.side-nav a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border-left: 2px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  font-size: 16px;
  text-decoration: none;
  transition: background 0.22s var(--ease), border-color 0.22s var(--ease);
}

.side-nav a:hover {
  background: var(--paper);
  border-left-color: var(--mint);
}

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

.prose {
  min-width: 0;
  overflow-wrap: break-word;
}

.prose > section {
  padding: clamp(18px, 3vw, 28px) 0 clamp(22px, 3vw, 32px);
  border-top: 1px solid var(--line);
  scroll-margin-top: 96px;
}

.prose > section:first-child {
  padding-top: 0;
  border-top: 0;
}

.prose > section:nth-of-type(even) {
  background: linear-gradient(90deg, rgba(212, 196, 168, 0.24) 0%, transparent 88%);
  padding-inline: clamp(12px, 2vw, 20px);
  border-radius: var(--radius);
}

.prose h2 {
  margin: 0 0 14px;
  font-size: clamp(22px, 3.4vw, 31px);
  line-height: 1.34;
  letter-spacing: -0.01em;
  scroll-margin-top: 96px;
}

.prose small + h2 {
  margin-top: 0;
}

.prose h3 {
  margin: 24px 0 10px;
  font-size: 20px;
  line-height: 1.45;
}

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

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

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

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

.prose a {
  color: var(--clay);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s var(--ease);
}

.prose a:hover {
  color: var(--mint-deep);
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.prose blockquote {
  margin: 20px 0;
  padding: 14px 18px;
  border-left: 5px solid var(--mint);
  border-radius: var(--radius);
  background: var(--sand-soft);
  color: var(--ink-soft);
}

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

.prose img {
  display: block;
  margin: 18px 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.prose figure {
  margin: 20px 0;
}

.prose figcaption {
  margin-top: 8px;
  font-size: 16px;
  color: var(--ink-soft);
}

.prose code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--paper-3);
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 15px;
}

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

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

.prose th {
  background: var(--sand-soft);
  font-weight: 600;
}

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

.foot {
  margin-top: clamp(28px, 6vw, 60px);
  padding: clamp(26px, 5vw, 48px) clamp(16px, 4vw, 40px) 0;
  background: var(--ink);
  background-image:
    radial-gradient(80% 70% at 10% 0%, rgba(92, 198, 176, 0.14) 0%, transparent 60%),
    radial-gradient(70% 70% at 92% 100%, rgba(212, 196, 168, 0.12) 0%, transparent 60%);
  color: var(--sand);
}

.foot-top {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-bottom: clamp(8px, 2vw, 16px);
  border-bottom: 1px solid rgba(212, 196, 168, 0.26);
}

.foot-mega {
  margin: 0;
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: clamp(48px, 13vw, 138px);
  line-height: 0.94;
  letter-spacing: -0.035em;
  color: transparent;
  -webkit-text-stroke: 1.4px var(--mint);
  text-shadow: 0 0 0 rgba(0, 0, 0, 0);
  word-break: break-all;
}

.foot-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 3vw, 30px);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 26px) 0;
}

.foot dl {
  margin: 0;
}

.foot dt {
  margin-bottom: 6px;
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 15px;
  letter-spacing: 0.16em;
  color: rgba(212, 196, 168, 0.7);
}

.foot dd {
  margin: 0;
}

.foot dd a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  color: var(--sand);
  font-size: 16px;
  text-decoration: none;
  transition: color 0.22s var(--ease), transform 0.22s var(--ease);
}

.foot dd a:hover {
  color: var(--mint);
  transform: translateX(3px);
}

.foot-base {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 0 26px;
  border-top: 1px solid rgba(212, 196, 168, 0.26);
  text-align: center;
}

.foot-base p {
  margin: 0;
  font-size: 16px;
  color: rgba(212, 196, 168, 0.82);
}

.totop {
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid rgba(212, 196, 168, 0.5);
  border-radius: 999px;
  background: transparent;
  color: var(--sand);
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.24s var(--ease), color 0.24s var(--ease), border-color 0.24s var(--ease);
}

.totop:hover {
  background: var(--mint);
  border-color: var(--mint);
  color: var(--ink);
}

/* ---------- 动效 ---------- */

@media (prefers-reduced-motion: no-preference) {
  .prose > article {
    animation: rise 0.55s var(--ease) both;
  }

  .prose > article:nth-child(1) { animation-delay: 0.02s; }
  .prose > article:nth-child(2) { animation-delay: 0.07s; }
  .prose > article:nth-child(3) { animation-delay: 0.12s; }
  .prose > article:nth-child(4) { animation-delay: 0.17s; }
  .prose > article:nth-child(5) { animation-delay: 0.22s; }
  .prose > article:nth-child(6) { animation-delay: 0.27s; }
  .prose > article:nth-child(7) { animation-delay: 0.32s; }

  .side-nav a,
  .veil-nav a,
  .foot dd a {
    animation: fade 0.45s var(--ease) both;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

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

@media (max-width: 999px) {
  .masthead {
    grid-template-columns: 1fr auto 1fr;
  }

  .rail {
    display: none;
  }

  .mark {
    grid-column: 2;
  }

  .burger {
    grid-column: 3;
  }

  .side-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .side-nav a {
    flex: 0 0 auto;
    padding: 0 14px;
    border-left: 0;
    background: var(--paper);
    white-space: nowrap;
  }

  .side-nav a:hover {
    border-left: 0;
  }
}

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

  .side {
    position: sticky;
    top: 92px;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 17px;
  }

  .hero {
    min-height: 46vh;
    padding-top: 42px;
  }

  .plate {
    width: 34vw;
    opacity: 0.95;
  }

  .plate-a {
    top: 4%;
    left: -3%;
    transform: rotate(-6deg);
  }

  .plate-b {
    right: -3%;
    bottom: 12%;
    transform: rotate(5deg);
  }

  .hero-copy {
    padding: 0 8px;
  }

  .foot-mega {
    -webkit-text-stroke-width: 1px;
  }
}

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