/* ============================================================
   编年 · 入场页
   纸 + 墨。所有颜色都从两个变量派生。
   ============================================================ */

@font-face {
  font-family: FanWunMing;
  src: url("../fonts/fanwunming-subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  --paper: #b8b8b8;
  --ink: #1b1b1d;
  --ink-70: rgba(27, 27, 29, .70);
  --ink-45: rgba(27, 27, 29, .45);
  --ink-20: rgba(27, 27, 29, .20);
  --ink-12: rgba(27, 27, 29, .12);
  --ink-08: rgba(27, 27, 29, .08);
  --horizon-y: 50%;
  --ease: cubic-bezier(.22, .61, .36, 1);

  --serif: FanWunMing, "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

html[data-theme="night"] {
  --paper: #0b0c0e;
  --ink: #ebe6da;
  --ink-70: rgba(235, 230, 218, .70);
  --ink-45: rgba(235, 230, 218, .45);
  --ink-20: rgba(235, 230, 218, .20);
  --ink-12: rgba(235, 230, 218, .12);
  --ink-08: rgba(235, 230, 218, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
  transition: background-color .6s var(--ease), color .6s var(--ease);
}

/* WebGL 不可用时退回一张静态的纸与雾，页面不至于空掉 */
body.no-3d::before {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 46vh;
  /* 白天：天空仍是纸灰，水面这一段换成深夜蓝（与 WebGL 深蓝海面保持一致） */
  background: linear-gradient(to bottom, #b8b8b8 0%, #b8b8b8 58%, #0e2647 100%);
  pointer-events: none;
}
/* 夜间保持原来的灰雾回退，一个像素都不变 */
html[data-theme="night"] body.no-3d::before {
  background: linear-gradient(to bottom, #b8b8b8 0%, #b8b8b8 58%, #9d9d9d 100%);
}

#sea {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}



/* ---------------- 顶栏 ---------------- */

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 26px 34px 0;
  z-index: 5;
}

.mark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.mark-cn {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: .34em;
}
.mark-en {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .34em;
  color: var(--ink-45);
  transform: translateY(-1px);
}

.bar-right {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.link {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  color: var(--ink-70);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0 0 2px;
  cursor: pointer;
  transition: color .25s var(--ease);
  position: relative;
}
.link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease);
}
.link:hover { color: var(--ink); }
.link:hover::after { transform: scaleX(1); }
.who {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--ink-45);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.who:empty { display: none; }

/* ---------------- 标题 ---------------- */

.hero {
  position: fixed;
  top: 17vh;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 3;
  padding: 0 24px;
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 5.1vw, 74px);
  line-height: 1.22;
  letter-spacing: .06em;
  text-indent: .06em;
}
.title .l1 { display: block; }

.meta {
  margin: 44px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--ink-45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.meta .dot {
  width: 22px;
  height: 1px;
  background: var(--ink-20);
  display: inline-block;
}

/* 文明分期小字：紧挨综述行，字号颜色与综述一致，略收字距以免长句溢出 */
.epoch {
  margin: 12px auto 0;
  padding: 0 20px;
  max-width: 52em;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  line-height: 1.85;
  color: var(--ink-45);
  text-align: center;
}
.epoch span { white-space: nowrap; }

/* ---------------- 登录卡 ---------------- */

.gate,
.enter {
  position: fixed;
  top: auto;
  bottom: 6vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(88vw, 340px);
  z-index: 4;
}

.card {
  padding: 26px 26px 22px;
  border: 1px solid rgba(255, 255, 255, .55);
  background: rgba(246, 246, 244, .93);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  box-shadow: 0 18px 54px rgba(20, 22, 26, .13);
}
html[data-theme="night"] .card {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(12, 14, 18, .42);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}

.eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .3em;
  color: var(--ink-45);
}

.card-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 20px;
  line-height: 1.65;
  letter-spacing: .06em;
}

.card-sub {
  margin: 14px 0 26px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  color: var(--ink-45);
}

.providers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--ink-20);
  background: rgba(255, 255, 255, .70);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .12em;
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}
.btn .ico {
  width: 16px;
  text-align: center;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1;
  color: var(--ink-70);
  transition: color .3s var(--ease);
}
.btn .btn-label { flex: 1; }
.btn .arw {
  font-size: 12px;
  opacity: .4;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.btn:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
html[data-theme="night"] .btn { background: rgba(255, 255, 255, .06); }
html[data-theme="night"] .btn:hover { background: var(--ink); color: #0b0c0e; }
.btn:hover .ico { color: var(--paper); }
.btn:hover .arw { opacity: 1; transform: translateX(3px); }
.btn.off {
  opacity: .38;
  cursor: not-allowed;
}
.btn.off:hover {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink-20);
}
.btn.off:hover .ico { color: var(--ink-70); }
.btn.off:hover .arw { transform: none; opacity: .4; }

.passcode {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  border-bottom: 1px solid var(--ink-12);
}
.passcode input {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .14em;
  outline: none;
}
.passcode input::placeholder { color: var(--ink-45); letter-spacing: .18em; }
.passcode button {
  border: 0;
  background: none;
  padding: 11px 2px;
  cursor: pointer;
  color: var(--ink-70);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .18em;
  transition: color .25s var(--ease);
}
.passcode button:hover { color: var(--ink); }

.fine {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  line-height: 1.7;
  color: var(--ink-45);
  min-height: 15px;
}
.fine.err { color: #b4452f; }

/* ---------------- 已登录入口 ---------------- */

.enter { text-align: center; }

.enter-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 40px;
  border: 1px solid var(--ink-20);
  color: var(--ink);
  text-decoration: none;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease);
}
.enter-cn {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .32em;
  text-indent: .32em;
}
.enter-en {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .28em;
  opacity: .5;
}
.enter-btn:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ---------------- 海面文字入口 ----------------
   位置与浮动都由 JS 每帧驱动（--link-y / --dx / --dy），
   这里的默认值只是没跑 JS 时的兜底。字号对齐 meta 那行「1531 — 2026」。 */

.sea-link {
  position: fixed;
  left: 50%;
  top: var(--link-y, 66.5%);
  transform: translate(-50%, -50%);
  z-index: 3;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .16em;
  text-indent: .16em;
  line-height: 1;
  white-space: nowrap;
  color: #5aaef3;          /* 夜间沿用原来的亮蓝，不动 */
  text-decoration: none;
  padding: 12px 18px;      /* 只撑大点击区，盒子仍以中心对齐 */
  cursor: pointer;
  transition: opacity .25s var(--ease);
}
.sea-link:hover,
.sea-link:focus-visible { opacity: .82; }
/* 白天：深蓝海面上换成纯白；夜间不匹配本条，仍是上面的 #5aaef3 */
html[data-theme="day"] .sea-link { color: #ffffff; }
html[data-theme="night"] .sea-link { text-shadow: 0 1px 6px rgba(0, 0, 0, .45); }

/* 每个字单独浮动：位移由 JS 逐帧写入，一个字一块水面 */
.sea-link .ch {
  display: inline-block;
  will-change: transform;
}

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

.foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 34px 22px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .22em;
  color: var(--ink-70);
  /* 压在水面上，用纸色托一圈，字才浮得起来 */
  text-shadow: 0 1px 12px rgba(255, 255, 255, .75), 0 0 4px rgba(255, 255, 255, .55);
  pointer-events: none;
  z-index: 5;
}

/* ---------------- 自适应 ---------------- */

@media (max-width: 760px) {
  :root { --horizon-y: 38%; }
  .bar { padding: 20px 20px 0; }
  .bar-right { gap: 13px; }
  .foot { padding: 0 20px 18px; }
  .foot-l { display: none; }
  .hero { top: 11vh; }
  .title { font-size: clamp(26px, 7.6vw, 40px); letter-spacing: .04em; }
  .meta { margin-top: 26px; font-size: 8.5px; letter-spacing: .10em; white-space: nowrap; }
  .epoch { margin-top: 10px; font-size: 8.5px; letter-spacing: .06em; line-height: 1.95; max-width: none; }
  .sea-link { font-size: 13px; letter-spacing: .12em; text-indent: .12em; padding: 14px 14px; }
  /* 窄屏把登录卡做成贴底的纸片，三个登录方式横排，别把水面全挡住 */
  .gate, .enter { bottom: 0; width: 100vw; left: 0; transform: none; }
  .eyebrow { display: none; }
  .providers { flex-direction: row; gap: 8px; }
  .btn { height: 42px; flex: 1; justify-content: center; gap: 7px; padding: 0 6px; }
  .btn .btn-label { flex: 0 0 auto; }
  .btn .arw { display: none; }
  .card {
    padding: 16px 18px 14px;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    background: rgba(246, 246, 244, .95);
  }
  html[data-theme="night"] .card { background: rgba(12, 14, 18, .88); }
  .card-title { font-size: 15px; line-height: 1.5; }
  .card-title br { display: none; }
  .card-sub { margin: 8px 0 14px; }
  .foot { display: none; }
  .card-title { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}
