/* ==========================================================
   Mercury Microelectronic Web · 像素世界风格
   Pixel-world theme
   ----------------------------------------------------------
   字体 / Fonts:
   - Press Start 2P  → 像素标题 Pixel display
   - EB Garamond     → 优雅的英文衬线 Elegant English serif
   - Noto Serif SC   → 优雅的中文衬线 Elegant Chinese serif
   ========================================================== */

:root {
  --ink:    #08080f;   /* 深夜底色 deep space */
  --panel:  #10101c;   /* 卡片底色 panel */
  --line:   #2a2a40;   /* 暗色描边 dim stroke */
  --white:  #eceaf4;   /* 像素白 pixel white */
  --dim:    #8f8fae;   /* 次要文字 secondary */
  --gold:   #d9b36c;   /* 优雅金 elegant gold */
  --mercury:#9fb4d8;   /* 水银蓝 mercury blue */
}

/* ---------- 层级背景递进 / Depth progression ----------
   像从深空走进点着灯的书房：每深入一层，
   底色由黑蓝向暖紫微微提亮，金色点缀随之更醒目 */
body.depth-1 { --ink: #0d0a1e; --panel: #161230; }
body.depth-2 { --ink: #130d29; --panel: #1d1738; }
body.depth-3 { --ink: #1a1136; --panel: #241c44; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--white);
  font-family: "Noto Serif SC", "EB Garamond", serif;
  line-height: 1.8;
  overflow-x: hidden;
}

/* 英文统一走 EB Garamond，稍小、斜体、压暗，作双语里的"第二声部" */
.en {
  font-family: "EB Garamond", serif;
  font-style: italic;
  color: var(--dim);
  font-size: 0.86em;
  letter-spacing: 0.02em;
}

.pixel {
  font-family: "Press Start 2P", monospace;
  letter-spacing: 0.04em;
}

a { color: inherit; text-decoration: none; }

/* ---------- 星空与扫描线 / Stars & scanlines ---------- */

#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.star {
  position: absolute;
  background: var(--white);
  image-rendering: pixelated;
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.star.gold   { background: var(--gold); }
.star.blue   { background: var(--mercury); }

@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 0.9; }
}

.scanlines {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 3px,
    rgba(0, 0, 0, 0.18) 3px, rgba(0, 0, 0, 0.18) 4px
  );
  /* 不用 mix-blend-mode：某些浏览器里它会阻止动态内容的重绘 */
}

/* ---------- 像素边框工具 / Pixel frame helpers ---------- */

.pixel-frame {
  box-shadow:
    0 -4px 0 0 var(--line),
    0 4px 0 0 var(--line),
    -4px 0 0 0 var(--line),
    4px 0 0 0 var(--line);
}

/* ---------- 导航 / Nav ---------- */

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(8, 8, 15, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--line);
}

.nav-brand { display: flex; align-items: center; gap: 10px; }

.nav-brand img {
  width: 28px; height: 28px;
  object-fit: contain;
  image-rendering: pixelated;
  border: 2px solid var(--line);
  background: var(--panel);
}

.nav-brand-text {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--gold);
  text-shadow: 2px 2px 0 rgba(217, 179, 108, 0.25);
}

.nav-links { display: flex; gap: 26px; font-size: 15px; }

.nav-links a { transition: color 0.2s; }
.nav-links a:hover { color: var(--gold); }

/* ---------- 首页 / Hero ---------- */

.sprite { image-rendering: pixelated; }

.hero {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 120px 24px 60px;
}

/* 角色舞台：小人居中，场景画作两侧陪伴 */
.hero-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 64px;
}

.float { animation: float 5s ease-in-out infinite; }

.hero-logo {
  position: relative;
  width: 200px; height: 200px;
  padding: 10px;
  background: var(--panel);
  border: 4px solid var(--white);
  box-shadow:
    0 0 0 4px var(--ink),
    0 0 0 8px var(--line),
    0 24px 60px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(159, 180, 216, 0.12);
  cursor: pointer;
  transition: border-color 0.25s;
}
.hero-logo:hover { border-color: var(--gold); }

.hero-logo > img {
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}

/* 点击小人的气泡彩蛋：出现在相框右侧 / speech bubble beside the frame
   气泡由 JS 在点击时动态创建（部分内嵌浏览器不重绘已有节点的显隐切换） */
.speech-bubble {
  position: absolute;
  left: calc(100% + 18px); top: 12%;
  width: max-content;
  max-width: 300px;
  padding: 14px 18px;
  background: var(--panel);
  border: 3px solid var(--gold);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45);
  text-align: left;
  z-index: 60; /* 盖过固定导航栏 */
  animation: bubble-in 0.25s ease;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.speech-bubble::after {
  content: "";
  position: absolute;
  left: -9px; top: 26px;
  width: 6px; height: 6px;
  background: var(--gold);
}
.speech-bubble .cn { font-size: 14.5px; line-height: 1.6; }
.speech-bubble .en { display: block; margin-top: 6px; font-size: 13px; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

.hero-title { margin-top: 44px; }

.hero-title .pixel {
  display: block;
  font-size: clamp(28px, 6vw, 52px);
  color: var(--white);
  text-shadow:
    4px 4px 0 var(--line),
    8px 8px 0 rgba(42, 42, 64, 0.5);
}

.hero-sub-en {
  display: block;
  margin-top: 18px;
  font-family: "EB Garamond", serif;
  font-style: italic;
  font-size: clamp(16px, 2.4vw, 22px);
  letter-spacing: 0.35em;
  color: var(--gold);
}

.hero-tagline {
  margin-top: 36px;
  font-size: clamp(16px, 2vw, 19px);
}

.hero-tagline .en { display: inline-block; margin-top: 6px; }

.cursor {
  color: var(--gold);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.scroll-hint {
  margin-top: 64px;
  font-size: 14px;
  color: var(--dim);
  animation: float 2.4s ease-in-out infinite;
}
.scroll-hint:hover { color: var(--gold); }

/* ---------- 像素分隔线 / Pixel divider ---------- */

.pixel-divider {
  height: 8px;
  margin: 0 auto;
  max-width: 720px;
  background:
    linear-gradient(to right,
      transparent 0 12px, var(--line) 12px 20px,
      transparent 20px calc(50% - 14px), var(--gold) calc(50% - 14px) calc(50% + 14px),
      transparent calc(50% + 14px) calc(100% - 20px), var(--line) calc(100% - 20px) calc(100% - 12px),
      transparent calc(100% - 12px));
  image-rendering: pixelated;
  opacity: 0.8;
}

/* ---------- 区块 / Sections ---------- */

.section {
  position: relative; z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 96px 24px 32px;
}

.section-label {
  font-size: 11px;
  color: var(--gold);
  opacity: 0.9;
  margin-bottom: 14px;
}

.section-title {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 600;
  margin-bottom: 34px;
}
.section-title .en { margin-left: 12px; font-size: 0.62em; }

/* 区块标题行：左文右画，手绘像素场景作点缀 */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.scene-figure {
  height: 118px;
  width: auto;
  margin-bottom: 20px; /* 与标题的 margin-bottom 对齐视觉基线 */
  opacity: 0.92;
  filter: drop-shadow(0 0 14px rgba(236, 234, 244, 0.06));
  animation: float 6s ease-in-out infinite;
  flex-shrink: 0;
}

/* ---------- 卡片 / Cards ---------- */

.card {
  background: var(--panel);
  border: 3px solid var(--line);
  padding: 30px 32px;
  position: relative;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.45);
  transition: border-color 0.25s, transform 0.25s;
}

.card:hover { border-color: var(--gold); transform: translate(-2px, -2px); }

.card .cn { font-size: 16px; }
.card .en { display: block; margin-top: 12px; font-size: 15px; }

/* 卡片左上角的像素角标 */
.card::before {
  content: "";
  position: absolute;
  top: 6px; left: 6px;
  width: 6px; height: 6px;
  background: var(--gold);
  opacity: 0.7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 26px;
}

.note-card h3 {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 14px;
}
.note-card h3 .en { display: block; font-size: 14px; margin-top: 4px; }

.note-card h3 a { transition: color 0.2s; }
.note-card h3 a:hover { color: var(--gold); }

/* 卡片底部：日期徽章 + 源文件下载 */
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
.card-foot .badge { margin-top: 0; }

.card-src {
  font-size: 12.5px;
  color: var(--dim);
  border: 2px solid var(--line);
  padding: 4px 10px;
  transition: color 0.2s, border-color 0.2s;
}
.card-src:hover { color: var(--gold); border-color: var(--gold); }

/* 笔记页顶部元信息里的下载链接 */
.note-dl {
  margin-left: 12px;
  font-family: "Noto Serif SC", "EB Garamond", serif; /* 别继承 pixel 字体，中文会糊 */
  color: var(--dim);
  border-bottom: 1px dashed var(--dim);
}
.note-dl:hover { color: var(--gold); border-bottom-color: var(--gold); }

.badge {
  display: inline-block;
  margin-top: 18px;
  padding: 4px 12px;
  font-size: 12.5px;
  color: var(--gold);
  border: 2px solid var(--gold);
  box-shadow: 3px 3px 0 rgba(217, 179, 108, 0.25);
}
.badge .en { color: inherit; font-size: 0.9em; }

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

.footer {
  position: relative; z-index: 1;
  text-align: center;
  padding: 70px 24px 46px;
  margin-top: 60px;
}

.footer .pixel { font-size: 10px; color: var(--dim); }
.footer .cn { font-size: 14px; color: var(--dim); margin-top: 14px; }

/* 像素地面场景：小人来回踱步，小电视守在尽头 */
.ground-scene {
  position: relative;
  height: 108px;
  max-width: 520px;
  margin: 0 auto 40px;
}

.pixel-ground {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 24px;
  background:
    linear-gradient(to right,
      var(--line) 0 24px, transparent 24px 48px,
      var(--line) 48px 96px, transparent 96px 120px,
      var(--gold) 120px 144px, transparent 144px 200px,
      var(--line) 200px 272px, transparent 272px 296px,
      var(--line) 296px 344px, transparent 344px 380px,
      var(--mercury) 380px 404px, transparent 404px 448px,
      var(--line) 448px 520px);
  opacity: 0.55;
}

.walker {
  position: absolute;
  left: 0; bottom: 20px;
  animation: walk 15s linear infinite alternate;
}

.walker.facing-left { transform: scaleX(-1); }

.walker-img {
  display: block;
  height: 62px;
  width: auto;
  animation: bob 0.55s steps(2) infinite;
}

@keyframes walk {
  from { left: 0; }
  to   { left: calc(100% - 46px); }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* ---------- 滚动显现 / Reveal on scroll ---------- */

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- 小屏适配 / Mobile ---------- */

@media (max-width: 600px) {
  .nav { padding: 12px 16px; }
  .nav-links { gap: 14px; font-size: 13px; }
  .nav-links .en { display: none; }
  .hero-stage { gap: 24px; }
  .hero-logo { width: 150px; height: 150px; }
  .scene-figure { height: 78px; }
  .speech-bubble {
    left: 50%; top: calc(100% + 14px);
    transform: translateX(-50%);
    max-width: 230px;
  }
  .speech-bubble::after { left: 50%; top: -9px; margin-left: -3px; }
  .card { padding: 24px 20px; }
}
