/* ============================================================
   漫步云海 · 像素 RPG 公共样式
   适用于 index / fun / projects / words 等内容页
   依赖：页面内需包含 .screen-frame、cloudstrip（可选）、页脚结构
   ============================================================ */

:root {
  --sky-1: #3d7fc0;
  --sky-2: #4f92d0;
  --sky-3: #63a6de;
  --sky-4: #7ab8e6;
  --ink: #16233a;
  --paper: #f8f5ec;
  --paper-sh: #ddd6c4;
  --amber: #e8a33d;
  --red: #c4453f;
  --nav-h: 60px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sky-2);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: 0.02em;
}

::selection { background: var(--amber); color: var(--ink); }

a:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }

.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 32px; }

main {
  flex: 1;
  /* 阶梯天空：四段平色 */
  background:
    linear-gradient(var(--sky-4) 0 0) top / 100% 20% no-repeat,
    linear-gradient(var(--sky-3) 0 0) top / 100% 44% no-repeat,
    linear-gradient(var(--sky-2) 0 0) top / 100% 72% no-repeat,
    var(--sky-1);
  padding-bottom: 96px;
}

/* ============ 顶栏 ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--nav-h);
  background: var(--sky-1);
  border-bottom: 3px solid var(--ink);
}

.nav .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--paper);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-shadow: 2px 2px 0 var(--ink);
}

.brand i {
  width: 12px; height: 12px;
  background: var(--amber);
  box-shadow: 4px 4px 0 0 var(--ink);
  flex: none;
}

.links { display: flex; }

.links a {
  position: relative;
  padding: 4px 14px;
  color: var(--paper);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-shadow: 2px 2px 0 var(--ink);
}

.links a + a::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 1px;
  background: rgba(248, 245, 236, 0.35);
}

.links a:hover { color: var(--amber); }
.links a[aria-current] { color: var(--amber); }

/* ============ 页头 ============ */
.page-head {
  padding: 72px 0 12px;
  text-align: center;
}

.page-head .ribbon {
  display: inline-block;
  padding: 2px 18px;
  background: var(--ink);
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--paper);
  text-shadow:
    4px 4px 0 var(--ink),
    8px 8px 0 rgba(22, 35, 58, 0.4);
}

/* ============ 区块标签 ============ */
section { padding: 36px 0 8px; }

.sec-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 3px 14px 3px 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.sec-tag::before {
  content: "";
  width: 7px; height: 7px;
  background: var(--amber);
}

.sec-tag .en {
  font-size: 10px;
  font-weight: 400;
  color: #9aa6bd;
  letter-spacing: 0.2em;
}

/* ============ 卡片：对话框面板 ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.item {
  position: relative;
  display: block;
  padding: 18px 20px 16px 34px;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow:
    inset 0 0 0 3px var(--paper-sh),
    7px 7px 0 0 rgba(22, 35, 58, 0.45);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.06s, box-shadow 0.06s;
}

div.item { cursor: default; }

.item::before {
  content: "";
  position: absolute;
  left: 11px; top: 24px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent var(--red);
  opacity: 0;
}

a.item:hover {
  background: #f0ead9;
  transform: translate(-2px, -2px);
  box-shadow:
    inset 0 0 0 3px var(--paper-sh),
    9px 9px 0 0 rgba(22, 35, 58, 0.45);
}

a.item:hover::before { opacity: 1; }
a.item:hover h3 { color: var(--red); }

.item h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.item p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.85;
  color: #5d6478;
}

.item .ext {
  position: absolute;
  right: 12px; top: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #b0893a;
}

/* ============ 说明面板 ============ */
.note {
  position: relative;
  padding: 20px 24px 18px 38px;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow:
    inset 0 0 0 3px var(--paper-sh),
    7px 7px 0 0 rgba(22, 35, 58, 0.45);
  font-size: 14.5px;
  color: #4a5268;
}

.note::before {
  content: "";
  position: absolute;
  left: 12px; top: 20px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent var(--red);
}

.note p { margin: 0 0 10px; }
.note p:last-child { margin-bottom: 0; }

code {
  padding: 2px 7px;
  background: var(--ink);
  color: var(--amber);
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 0.9em;
}

/* ============ 天空装饰：云与飞鸟（铺满 main 背景） ============ */
main { position: relative; }

main > .wrap { position: relative; z-index: 2; }

.sky-deco {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.sky-deco svg { position: absolute; image-rendering: pixelated; display: block; }

/* 远层散云 */
.sky-deco .f1 { left: 10%; top: 70px;  animation: drift 26s steps(26) infinite; opacity: 0.8; }
.sky-deco .f2 { left: 52%; top: 40px;  animation: drift 30s steps(30) infinite reverse; opacity: 0.75; }
.sky-deco .f3 { left: 86%; top: 110px; animation: drift 24s steps(24) infinite; opacity: 0.8; }

/* 云群：整团漂移，群内咬合成片；scale 独立于 transform，不与 drift 冲突 */
.sky-deco .bank { position: absolute; scale: 0.75; }
.sky-deco .bank.k1 { left: 1%;  top: 180px; animation: drift 14s steps(28) infinite; }
.sky-deco .bank.k2 { left: 42%; top: 380px; animation: drift 18s steps(36) infinite reverse; }
.sky-deco .bank.k3 { left: 74%; top: 640px; animation: drift 11s steps(22) infinite; }

.sky-deco .f4 { left: 24%; top: 150px; animation: drift 27s steps(27) infinite reverse; opacity: 0.78; }

.sky-deco .bank.k4 { left: 12%; top: 540px; animation: drift 20s steps(40) infinite reverse; }
.k4 .k4a { left: 80px; top: 0; }
.k4 .k4b { left: 0;    top: 26px; }

/* ---- 每页分布：projects 右倾对角 ---- */
.pg-projects .sky-deco .bank.k1 { left: 6%;  top: 160px; }
.pg-projects .sky-deco .bank.k2 { left: 58%; top: 300px; }
.pg-projects .sky-deco .bank.k3 { left: 68%; top: 620px; }
.pg-projects .sky-deco .bank.k4 { left: 14%; top: 500px; }
.pg-projects .sky-deco .f1 { left: 6%;  top: 60px; }
.pg-projects .sky-deco .f2 { left: 70%; top: 60px; }
.pg-projects .sky-deco .f4 { left: 34%; top: 210px; }

/* ---- 每页分布：fun 右上散布 ---- */
.pg-fun .sky-deco .bank.k1 { left: 66%; top: 170px; }
.pg-fun .sky-deco .bank.k2 { left: 6%;  top: 360px; }
.pg-fun .sky-deco .bank.k3 { left: 38%; top: 640px; }
.pg-fun .sky-deco .bank.k4 { left: 82%; top: 820px; }
.pg-fun .sky-deco .f1 { left: 30%; top: 50px; }
.pg-fun .sky-deco .f3 { left: 8%;  top: 130px; }
.pg-fun .sky-deco .f4 { left: 88%; top: 60px; }

/* ---- 每页分布：words 左下厚重 ---- */
.pg-words .sky-deco .bank.k1 { left: 28%; top: 140px; }
.pg-words .sky-deco .bank.k2 { left: 72%; top: 330px; }
.pg-words .sky-deco .bank.k3 { left: 4%;  top: 600px; }
.pg-words .sky-deco .bank.k4 { left: 52%; top: 760px; }
.pg-words .sky-deco .f1 { left: 60%; top: 60px; }
.pg-words .sky-deco .f2 { left: 14%; top: 80px; }
.pg-words .sky-deco .f4 { left: 84%; top: 180px; }

/* 群内排布（与首页一致） */
.k1 .k1a { left: 0;     top: 30px; }
.k1 .k1b { left: 180px; top: 6px; }
.k1 .k1c { left: 90px;  top: 52px; }
.k2 .k2a { left: 0;     top: 0; }
.k2 .k2b { left: 90px;  top: 26px; }
.k2 .k2c { left: 250px; top: 48px; }
.k3 .k3a { left: 0;     top: 34px; }
.k3 .k3b { left: 250px; top: 0; }
.k3 .k3c { left: 110px; top: 66px; }

.pbird { position: absolute; left: -8%; image-rendering: pixelated; }
.pbird svg { display: block; }
.pbird .wing { animation: flap 0.5s steps(2) infinite; }

.pbird.b1 { top: 140px; animation: fly 15s steps(45) -2s infinite; }
.pbird.b2 { top: 300px; animation: fly 21s steps(63) -12s infinite; }
.pbird.b3 { top: 480px; animation: fly 26s steps(78) -19s infinite; }
.pbird.b3 svg { transform: scale(0.7); transform-origin: center; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(16px, -4px); }
  50%      { transform: translate(32px, 0); }
  75%      { transform: translate(16px, 4px); }
}

@keyframes flap {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(-1); }
}

@keyframes fly {
  0%   { transform: translateX(0); }
  100% { transform: translateX(116vw); }
}

@media (max-width: 640px) {
  .sky-deco .bank.k2 { display: none; }
  .sky-deco .bank { scale: 0.5; }
  .sky-deco .f2 { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sky-deco svg, .pbird, .pbird .wing { animation: none; }
  .pbird { left: 55%; }
  .pbird svg { transform: none; }
}

/* ============ 页脚：状态栏 ============ */
footer {
  flex: none;
  border-top: 3px solid var(--ink);
  background: var(--ink);
  padding: 10px 32px 12px;
  text-align: center;
  font-size: 12px;
  color: #9aa6bd;
  letter-spacing: 0.1em;
  line-height: 1.8;
}

footer .row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 0;
}

footer a { color: #c8d2e2; text-decoration: none; }
footer a:hover { color: var(--amber); text-decoration: underline; }

footer .sep {
  display: inline-block;
  margin: 0 14px;
  width: 5px; height: 5px;
  background: #3a4a68;
  vertical-align: middle;
}

footer .police {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
footer .police img {
  width: auto; height: 13px;
  display: block;
  image-rendering: pixelated;
  opacity: 0.85;
}

/* ============ 整屏画框 ============ */
.screen-frame {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  border: 5px solid var(--ink);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 6px var(--ink);
}

/* ============ 响应式 ============ */
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .page-head { padding-top: 48px; }
  .page-head h1 { letter-spacing: 0.18em; text-indent: 0.18em; }
  .links a { padding: 4px 8px; letter-spacing: 0.1em; }
  .item, .note { padding-left: 30px; }
  .item::before { left: 9px; }
  .note::before { left: 9px; top: 16px; }
}
