/* ============================================================
   base.css —— 地基层。配色、字体、导航、页脚、雨幕图层。
   Step 1 完成后原则上冻结，模块样式请写进各自的 css 文件。
   移动优先，唯一的桌面断点在文件末尾。
   ============================================================ */

:root {
  /* 逆流而上的雨：低饱和、做旧、冷底暖点。刻意不用霓虹色。 */
  --bg:        #0e100f;   /* 底：偏墨绿的近黑，不是纯黑 */
  --bg-raise:  #171a18;
  --bg-sink:   #0a0b0a;
  --line:      #2a2e2b;
  --ink:       #e4e0d6;   /* 旧纸白 */
  --ink-dim:   #9a9488;
  --ink-mute:  #66625b;
  --gold:      #c9a45c;   /* 做旧金：强调 */
  --seal:      #8f4a3c;   /* 封蜡红：警示 */
  --rain:      #b9c6c4;   /* 雨线 */
  --live:      #6f8f68;
  --radius: 10px;

  /* 中文衬线栈：不下载任何字体就能拿到复古印刷调性 */
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC",
           "SimSun", "宋体", Georgia, serif;
  --sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* 极淡胶片颗粒：静态渲染一次，不消耗每帧性能 */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 2;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 雨幕画布：铺满视口，垫在内容下面 */
#rain {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
  /* 顶部淡出，雨消失于天空 */
  mask-image: linear-gradient(to top, #000 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(to top, #000 55%, transparent 100%);
}

/* 内容永远在雨之上 */
.site-head, main, .site-foot { position: relative; z-index: 1; }

a { color: var(--gold); text-decoration: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: 720px; margin-inline: auto; padding-inline: 16px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ---------- 顶栏 ---------- */

.site-head {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-sink) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 3;
}
.head-row { display: flex; align-items: center; padding-block: 13px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand-mark {
  width: 22px; height: 22px; flex: none;
  border: 1px solid var(--gold);
  transform: rotate(45deg);           /* 四芒星的骨架：菱形 */
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 5px;
  background: var(--gold);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong {
  font-family: var(--serif);
  font-size: 17px; font-weight: 600; letter-spacing: .12em;
}
.brand-text small {
  font-size: 10px; letter-spacing: .3em;
  color: var(--ink-mute); text-transform: uppercase;
}

/* 导航：手机上横向滚动，不换行不挤压 */
.site-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 11px; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  flex: none; padding: 6px 14px;
  font-size: 14px; color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 999px;
  white-space: nowrap;
}
.site-nav a[aria-current="page"] {
  color: var(--bg); background: var(--gold); border-color: var(--gold);
}

/* ---------- 页头 ---------- */

.page-head { padding-block: 26px 6px; }
.page-head h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 26px; font-weight: 600; letter-spacing: .06em; line-height: 1.35;
}
.page-head .lede { margin: 0; font-size: 14px; color: var(--ink-dim); }

.stamp {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 14px; padding: 5px 12px;
  font-size: 12px; color: var(--ink-dim);
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: 999px;
}
.stamp b { color: var(--ink); font-weight: 600; }

/* ---------- 搜索框 ---------- */

.filter { padding-block: 16px 2px; }
.filter input {
  width: 100%; padding: 11px 14px;
  font-size: 16px;              /* 低于 16px 时 iOS 会自动放大整页 */
  font-family: inherit; color: var(--ink);
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius);
}
.filter input::placeholder { color: var(--ink-mute); }
.filter input:focus { border-color: var(--gold); outline: none; }

/* ---------- 通用按钮 ---------- */

.btn {
  padding: 8px 15px; min-height: 38px;   /* 手机上要够大才好点 */
  font-size: 14px; font-family: inherit;
  color: var(--bg); background: var(--gold);
  border: none; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.done { background: var(--live); }

/* ---------- 占位与状态 ---------- */

.state { padding: 30px 4px; text-align: center; font-size: 14px; color: var(--ink-mute); }
.todo {
  margin: 20px 0; padding: 18px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  font-size: 14px; color: var(--ink-dim);
}
.todo b { display: block; margin-bottom: 4px; color: var(--gold); font-weight: 600; }

/* ---------- 页脚 ---------- */

.site-foot {
  margin-top: 16px; padding-block: 22px 36px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-mute);
}
.site-foot p { margin: 4px 0; }

/* ---------- 唯一的桌面断点 ---------- */

@media (min-width: 768px) {
  body { font-size: 17px; }
  .wrap { max-width: 880px; padding-inline: 28px; }
  .head-row { padding-block: 16px; }
  .site-nav { padding-bottom: 0; }
  .site-nav a:hover { color: var(--ink); border-color: var(--gold); }
  .page-head { padding-block: 44px 8px; }
  .page-head h1 { font-size: 34px; }
}

@media (prefers-reduced-motion: no-preference) {
  .site-nav a, .btn { transition: color .18s ease, background-color .18s ease, border-color .18s ease; }
}
