/* ---------- 入口门（全屏覆盖） ---------- */

/* 挂门前首屏隐藏（防 FOUC）：未答题用户在 gate.js 挂载前预先隐藏 body，避免冷加载闪现主站 */
html.gate-pending {
  background: var(--paper, #f6f3ec);
}
html.gate-pending body {
  visibility: hidden !important;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 1;
  /* 卡片比视口高时（矮屏 / 放大字号）不能把上下切掉：允许滚动，
     并用 padding 留出呼吸空间，避免卡片贴着屏幕边缘。 */
  overflow-y: auto;
  padding: 1.2rem 0;
  box-sizing: border-box;
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s linear 0s;
}
/* 丝滑退场: 整层淡出 + 上移；结束后 display:none 由 JS 处理 */
.gate.hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s linear 0.7s;
  pointer-events: none;
}

/* 纸张上升的入场感 */
.gate-inner {
  position: relative;
  width: min(92vw, 380px);
  padding: 3rem 2.2rem 2.6rem;
  /* 滚动容器里居中时，margin:auto 能保证「够高就居中、超高可滚动」 */
  margin: auto;
  flex: 0 0 auto;
  background: #fffef9;
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line), 0 18px 50px -18px rgba(38, 36, 31, 0.25);
  text-align: center;
  transform: none;
}
.gate.hidden .gate-inner { transform: translateY(-1.2rem); transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1); }

/* 印章数字 */
.gate .g-num {
  font-family: var(--anth-serif);
  font-style: italic;
  font-size: 2.6rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  line-height: 1;
}
.gate .g-sub {
  font-family: var(--wenkai);
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}
.gate .g-hint {
  font-family: var(--anth-serif);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  margin-top: 1.6rem;
  text-transform: uppercase;
}

.gate .g-q {
  margin-top: 1.8rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
}
.gate .g-q span {
  display: block;
  font-family: var(--anth-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--ink-faint);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  margin-top: 0.3rem;
  text-transform: uppercase;
}

.gate input[type="text"] {
  margin-top: 1.1rem;
  text-align: center;
  letter-spacing: 0.4em;
  font-family: var(--anth-mono);
  text-transform: uppercase;
}
.gate .g-btn {
  margin-top: 1.1rem;
  width: 100%;
}
.gate .g-err {
  min-height: 1.4em;
  margin-top: 0.7rem;
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 0.3s;
}
.gate .g-err.show { opacity: 1; }

/* ---------- 卡片底部署名 ---------- */
.gate .g-credits {
  margin-top: 1.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.gate .g-credit-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
}
.gate .g-credit {
  display: inline-flex;
  align-items: center;
  gap: 0.36em;
  font-family: var(--anth-serif);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.gate .g-logo {
  width: 13px;
  height: 13px;
  flex: none;
  display: block;
}
.gate .g-copy {
  margin-top: 0.8rem;
  font-family: var(--anth-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  opacity: 0.75;
}

/* 输入框抖动（答错时） */
@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-7px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  80% { transform: translateX(-2px); }
}
.gate input.shake { animation: gate-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97); }

/* 进入瞬间: 印章放大盖章 */
@keyframes gate-stamp {
  0% { transform: scale(2.2) rotate(-8deg); opacity: 0; }
  55% { transform: scale(0.94) rotate(-2deg); opacity: 1; }
  100% { transform: scale(1) rotate(-1.5deg); opacity: 1; }
}
.gate .g-seal {
  position: absolute;
  top: 1.1rem; right: 1.1rem;
  width: 44px; height: 44px;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.68rem;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 3px;
  opacity: 0;
  transform: rotate(-1.5deg);
  pointer-events: none;
}
.gate.ok .g-seal { display: flex; animation: gate-stamp 0.55s cubic-bezier(0.34, 1.3, 0.5, 1) 0.15s forwards; }

/* 页面内容入场
   注：.reveal 的实际进场动画已由 fx.css 的折纸展开接管（作用在 > .wrap 上），
   这里只保留滚动锁与错落延迟，避免两套 transform 互相覆盖。 */
body.gated { overflow: hidden; }

.reveal.d1 > .wrap { transition-delay: 0.08s; }
.reveal.d2 > .wrap { transition-delay: 0.16s; }
.reveal.d3 > .wrap { transition-delay: 0.24s; }
.reveal.d4 > .wrap { transition-delay: 0.32s; }
.reveal.d5 > .wrap { transition-delay: 0.4s; }

/* 没有加载 fx.css 时的兜底（单独打开某页也不至于白屏） */
.no-fx .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .gate, .gate.hidden, .reveal, .gate input.shake, .roster-item { transition: none; animation: none; }
  .reveal, .reveal > .wrap { opacity: 1; transform: none; }
}

/* ---------- 站内常驻微动画 ---------- */

/* 导航下划线滑入 */
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: -0.55em;
  height: 2px;
  background: var(--accent);
  transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav a:hover::after, .nav a[aria-current="page"]::after { right: 0; }
.nav a[aria-current="page"]::after { background: var(--accent); }

/* 按钮: 悬停时内衬从左滑入 */
.btn {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: transparent;
  isolation: isolate;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}
.btn:hover { color: var(--paper); border-color: var(--ink); }
.btn:hover::before { transform: scaleX(1); }
.btn.primary { border-color: var(--accent); }
.btn.primary::before { background: var(--accent-deep, #7d2620); }
.btn.primary:hover { border-color: var(--accent-deep, #7d2620); }

/* 时间线圆点、照片卡的悬停只在 fx.css 里写一份（这里原来也有，加载顺序在前，全被盖掉了）。 */

/* 留言卡: 悬停边线染朱砂（和 fx.css 的墨晕是同一个效果的两半，不重复） */
.msg { transition: border-color 0.3s, transform 0.3s cubic-bezier(0.25, 0.6, 0.3, 1); }
.msg:hover { border-color: rgba(164, 52, 42, 0.45); transform: translateY(-2px); }

/* 人物卡: 悬停浮起 + 虚线变实线感（颜色加深） */
.person { transition: transform 0.3s cubic-bezier(0.25, 0.6, 0.3, 1), border-color 0.3s, color 0.3s; }
.person:hover { transform: translateY(-4px); border-color: var(--gold); color: var(--ink-soft); }
.person .av { transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.5, 1); }
.person:hover .av { transform: scale(1.08); }

/* 输入框聚焦: 金色边线渐显 */
input:focus, textarea:focus, select:focus {
  transition: border-color 0.25s, box-shadow 0.25s;
  box-shadow: 0 0 0 3px rgba(154, 123, 63, 0.12);
}

/* hero 背景数字: 缓慢漂移（极轻） */
@keyframes bg-drift {
  from { transform: translateY(0); }
  to { transform: translateY(-1.2rem); }
}
.hero .bg-num { animation: bg-drift 9s ease-in-out infinite alternate; }

/* ---------- 密码页上的论坛入口 ---------- */
.g-forum-link {
  display: block;
  margin-top: 1.1rem;
  font-family: var(--anth-serif, "Anthropic Serif", serif);
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-align: center;
  text-decoration: none;
  transition: color 0.2s, letter-spacing 0.2s;
}
.g-forum-link:hover {
  color: var(--accent);
  letter-spacing: 0.1em;
}

/* ---------- 密码门语言切换 ----------
   密码门是全屏覆盖层，站内导航的语言按钮被它盖住。
   这里在卡片内单独放一组：不加外框，只用细线与上下内容分隔，
   避免和卡片自身的边框、credits 的分隔线叠成好几道横线。 */
.g-langs {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.95rem;
}

.g-lang {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 0.42em 0.72em;
  background: transparent;
  color: var(--ink-faint);
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.g-lang:hover {
  color: var(--ink);
  border-color: var(--line);
}

.g-lang.active {
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}

/* 窄屏：卡片内边距收紧，语言按钮略放大以便点按（≥40px 触控目标） */
@media (max-width: 480px) {
  .g-langs {
    gap: 0.35rem;
    margin-top: 0.85rem;
  }
  .g-lang {
    font-size: 0.76rem;
    padding: 0.55em 0.85em;
  }
}

/* 矮屏 / 手机：收紧卡片上下的留白，尽量让整张卡片不用滚动就能看全 */
@media (max-height: 680px) {
  .gate-inner {
    padding: 2rem 1.6rem 1.7rem;
  }
  .gate .g-num {
    font-size: 2.1rem;
  }
  .gate .g-credits {
    margin-top: 1.1rem;
    padding-top: 0.85rem;
  }
}

@media (max-width: 480px) {
  .gate-inner {
    width: min(93vw, 380px);
    padding: 2.2rem 1.5rem 2rem;
  }
}
