/* ============================================================
   泰罗 & 托雷基亚 光与暗羁绊认证页 · 样式
   配色令牌：深蓝暗黑 + 金色微光 + 冷白光（展示型暗底金属风）
   字号档位：--fs-tiny 10 / --fs-aux 12 / --fs-body 14 /
             --fs-h 16 / --fs-num 20；
             hero 与章节大标题属展示型流式字号特例（clamp 承载）
   ============================================================ */

:root {
  --bg-deep: #05070f;
  --bg-mid: #0a0f1f;
  --gold: #c9a84c;
  --gold-bright: #e8d48b;
  --white-cold: #e8edf5;
  --white-dim: rgba(232, 237, 245, 0.62);
  --white-faint: rgba(232, 237, 245, 0.38);
  --blue-glow: #5b7fb8;
  --line-faint: rgba(201, 168, 76, 0.35);

  --fs-tiny: 10px;
  --fs-aux: 12px;
  --fs-body: 14px;
  --fs-h: 16px;
  --fs-num: 20px;

  --font-serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-deep);
  color: var(--white-cold);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.9;
  letter-spacing: 0.06em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

/* ---------- 星尘粒子与光斑 ---------- */
#stardust {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

#cursor-glow {
  position: fixed;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(201, 168, 76, 0.10) 0%,
    rgba(201, 168, 76, 0.045) 38%,
    transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* ---------- 开场加载 ---------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  transition: opacity 1.1s ease;
}

#loader.done { opacity: 0; pointer-events: none; }

.loader-orb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 18px 4px rgba(232, 212, 139, 0.75),
              0 0 60px 14px rgba(201, 168, 76, 0.35);
  animation: orb-breathe 2.2s ease-in-out infinite;
}

.loader-text {
  font-family: var(--font-serif);
  font-size: var(--fs-h);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--white-dim);
  animation: text-fade 2.4s ease-in-out infinite;
}

@keyframes orb-breathe {
  0%, 100% { opacity: 0.55; transform: scale(0.82); }
  50%      { opacity: 1;    transform: scale(1.05); }
}

@keyframes text-fade {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.95; }
}

/* ---------- 首屏 ---------- */
#hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    url("../assets/scene_divide.jpg") center 38% / cover no-repeat,
    var(--bg-mid);
  overflow: hidden;
}

.hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(5, 7, 15, 0.72) 0%,
      rgba(5, 7, 15, 0.30) 34%,
      rgba(5, 7, 15, 0.38) 62%,
      rgba(5, 7, 15, 0.96) 100%),
    radial-gradient(ellipse at center,
      transparent 40%,
      rgba(5, 7, 15, 0.55) 100%);
}

.hero-inner {
  position: relative;
  z-index: 4;
  padding: 0 24px;
  animation: hero-breathe 6.5s ease-in-out infinite;
}

@keyframes hero-breathe {
  0%, 100% { filter: brightness(0.94); }
  50%      { filter: brightness(1.06); }
}

.hero-pre {
  font-size: var(--fs-aux);
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  color: var(--white-faint);
  margin-bottom: 22px;
}

.hero-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(34px, 8.4vw, 64px);
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  color: var(--white-cold);
  text-shadow: 0 0 34px rgba(201, 168, 76, 0.42),
               0 2px 18px rgba(5, 7, 15, 0.9);
  margin-bottom: 20px;
}

.hero-names {
  font-family: var(--font-serif);
  font-size: clamp(17px, 3.6vw, 24px);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--gold-bright);
}

.hero-x {
  color: var(--white-faint);
  font-size: 0.8em;
  padding: 0 0.35em;
}

.hero-en {
  margin-top: 30px;
  font-size: var(--fs-h);
  font-style: italic;
  letter-spacing: 0.34em;
  color: var(--white-dim);
  text-shadow: 0 0 16px rgba(91, 127, 184, 0.55);
}

.scroll-hint {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 56px;
  background: linear-gradient(180deg, transparent, var(--line-faint));
  z-index: 4;
}

.scroll-hint span {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 18px;
  background: var(--gold-bright);
  animation: hint-drop 2.2s ease-in-out infinite;
}

@keyframes hint-drop {
  0%   { transform: translateY(0);    opacity: 0; }
  25%  { opacity: 1; }
  75%  { transform: translateY(38px); opacity: 1; }
  100% { transform: translateY(38px); opacity: 0; }
}

/* ---------- 章节通用 ---------- */
.chapter { position: relative; }

.scene {
  position: relative;
  height: min(88vh, 760px);
  overflow: hidden;
}

.scene img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.72) brightness(0.8) contrast(1.04);
}

.scene-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      var(--bg-deep) 0%,
      rgba(5, 7, 15, 0.18) 26%,
      rgba(5, 7, 15, 0.18) 62%,
      var(--bg-deep) 100%);
}

.chapter-body {
  position: relative;
  z-index: 4;
  text-align: center;
  padding: 0 28px;
  margin-top: -92px;
}

.chapter-no {
  display: block;
  font-family: var(--font-serif);
  font-size: var(--fs-aux);
  letter-spacing: 0.7em;
  text-indent: 0.7em;
  color: var(--gold);
}

.chapter-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(26px, 5.4vw, 40px);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--white-cold);
  margin: 14px 0 22px;
  text-shadow: 0 0 26px rgba(201, 168, 76, 0.3);
}

.chapter-text {
  max-width: 560px;
  margin: 0 auto;
  color: var(--white-dim);
  font-size: var(--fs-body);
}

.chapter-en {
  margin-top: 18px;
  font-style: italic;
  font-size: var(--fs-aux);
  letter-spacing: 0.22em;
  color: var(--white-faint);
}

/* ---------- 贰 · 双生 ---------- */
#portrait {
  padding: 110px 0 130px;
  background: linear-gradient(180deg,
    var(--bg-deep) 0%,
    var(--bg-mid) 50%,
    var(--bg-deep) 100%);
}

.portrait-head { text-align: center; padding: 0 28px; }

.portrait-sub {
  margin-top: -8px;
  font-size: var(--fs-aux);
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: var(--white-faint);
}

.portrait-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px;
  max-width: 880px;
  margin: 54px auto 0;
  padding: 0 28px;
}

.portrait { text-align: center; }

.portrait-frame {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line-faint);
}

.portrait-frame img {
  width: 100%;
  aspect-ratio: 1 / 1.08;
  object-fit: cover;
  object-position: top center;
}

.portrait.light .portrait-frame img { filter: saturate(0.8) brightness(0.94); }
.portrait.dark .portrait-frame img  { filter: saturate(0.7) brightness(0.8); }

.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
    transparent 52%,
    rgba(5, 7, 15, 0.52) 100%);
}

.portrait.light .portrait-frame {
  box-shadow: 0 0 44px rgba(201, 168, 76, 0.14) inset,
              0 10px 40px rgba(0, 0, 0, 0.5);
}

.portrait.dark .portrait-frame {
  border-color: rgba(91, 127, 184, 0.35);
  box-shadow: 0 0 44px rgba(91, 127, 184, 0.16) inset,
              0 10px 40px rgba(0, 0, 0, 0.5);
}

.portrait figcaption { padding: 24px 6px 0; }

.portrait h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--fs-num);
  letter-spacing: 0.28em;
  text-indent: 0.28em;
}

.portrait.light h3 { color: var(--gold-bright); }
.portrait.dark h3  { color: #9db8de; }

.portrait h3 span {
  font-size: var(--fs-tiny);
  letter-spacing: 0.4em;
  color: var(--white-faint);
  display: block;
  margin-top: 4px;
}

.traits {
  list-style: none;
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.traits li {
  font-size: var(--fs-aux);
  letter-spacing: 0.14em;
  color: var(--white-dim);
  border: 1px solid rgba(232, 237, 245, 0.16);
  border-radius: 2px;
  padding: 3px 10px;
}

.portrait-line {
  margin-top: 18px;
  font-size: var(--fs-aux);
  color: var(--white-faint);
}

/* ---------- 肆 · 认证 ---------- */
#certify {
  padding: 130px 28px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%,
      rgba(201, 168, 76, 0.06) 0%,
      transparent 60%),
    var(--bg-deep);
}

.certify-inner .chapter-text { margin-bottom: 40px; }

#cert-btn {
  font-family: var(--font-serif);
  font-size: var(--fs-h);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--gold-bright);
  background: linear-gradient(180deg,
    rgba(201, 168, 76, 0.16) 0%,
    rgba(201, 168, 76, 0.06) 100%);
  border: 1px solid var(--gold);
  border-radius: 2px;
  padding: 15px 44px;
  cursor: pointer;
  position: relative;
  transition: box-shadow 0.5s ease, transform 0.5s ease, background 0.5s ease;
  animation: btn-breathe 3.4s ease-in-out infinite;
}

#cert-btn:hover {
  background: linear-gradient(180deg,
    rgba(201, 168, 76, 0.3) 0%,
    rgba(201, 168, 76, 0.12) 100%);
  box-shadow: 0 0 30px rgba(201, 168, 76, 0.35);
  transform: translateY(-2px);
}

@keyframes btn-breathe {
  0%, 100% { box-shadow: 0 0 10px rgba(201, 168, 76, 0.12); }
  50%      { box-shadow: 0 0 26px rgba(201, 168, 76, 0.3); }
}

.certify-hint {
  margin-top: 22px;
  font-size: var(--fs-tiny);
  letter-spacing: 0.3em;
  color: var(--white-faint);
}

/* ---------- 认证卡 ---------- */
#cert-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#cert-modal[hidden] { display: none; }

.cert-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 10, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.5s ease both;
}

.cert-card {
  position: relative;
  width: min(380px, 92vw);
  max-height: 88vh;
  max-height: 88svh;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 50% -10%,
      rgba(201, 168, 76, 0.1) 0%,
      transparent 55%),
    linear-gradient(180deg, #0b1122 0%, #060a16 100%);
  border: 1px solid var(--gold);
  outline: 1px solid rgba(201, 168, 76, 0.22);
  outline-offset: 5px;
  border-radius: 3px;
  text-align: center;
  padding: 42px 30px 34px;
  animation: card-rise 0.65s cubic-bezier(0.22, 0.8, 0.32, 1) both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes card-rise {
  from { opacity: 0; transform: translateY(26px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cert-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  background: none;
  border: none;
  color: var(--white-faint);
  font-size: 22px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.cert-close:hover { color: var(--gold-bright); }

.cert-head {
  font-size: var(--fs-tiny);
  letter-spacing: 0.52em;
  text-indent: 0.52em;
  color: var(--gold);
}

.cert-duo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 26px 0 18px;
}

.cert-figure {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line-faint);
}

.cert-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.cert-light { box-shadow: 0 0 22px rgba(201, 168, 76, 0.4); }
.cert-dark  { box-shadow: 0 0 22px rgba(91, 127, 184, 0.4); border-color: rgba(91, 127, 184, 0.45); }

.cert-link {
  width: 46px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), var(--blue-glow));
}

.cert-names {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--fs-num);
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--white-cold);
}

.cert-divider {
  margin: 16px auto;
  color: var(--gold);
  font-size: var(--fs-aux);
}

.cert-motto {
  font-family: var(--font-serif);
  font-size: var(--fs-h);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--gold-bright);
}

.cert-en {
  margin-top: 10px;
  font-style: italic;
  font-size: var(--fs-aux);
  letter-spacing: 0.26em;
  color: var(--white-dim);
}

.cert-meta {
  margin-top: 26px;
  border-top: 1px solid rgba(201, 168, 76, 0.2);
  padding-top: 18px;
  display: grid;
  gap: 6px;
}

.cert-meta div {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.cert-meta dt {
  font-size: var(--fs-aux);
  color: var(--white-faint);
  letter-spacing: 0.2em;
}

.cert-meta dd {
  font-size: var(--fs-aux);
  color: var(--white-dim);
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}

.cert-seal {
  width: 74px;
  height: 74px;
  margin: 24px auto 0;
  border: 2px solid rgba(201, 168, 76, 0.75);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-12deg);
  box-shadow: 0 0 18px rgba(201, 168, 76, 0.22) inset;
}

.cert-seal span {
  font-family: var(--font-serif);
  font-size: var(--fs-aux);
  line-height: 1.5;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--gold-bright);
}

.cert-save-hint {
  margin-top: 22px;
  font-size: var(--fs-tiny);
  letter-spacing: 0.26em;
  color: var(--white-faint);
}

/* ---------- 页脚 ---------- */
#footer {
  text-align: center;
  padding: 56px 24px 64px;
  border-top: 1px solid rgba(201, 168, 76, 0.14);
}

#footer p {
  font-family: var(--font-serif);
  font-size: var(--fs-aux);
  letter-spacing: 0.3em;
  color: var(--white-dim);
}

.footer-sub {
  margin-top: 10px;
  font-size: var(--fs-tiny);
  color: var(--white-faint);
}

.story-entry {
  display: inline-block;
  margin-top: 26px;
  padding: 11px 34px;
  border: 1px solid rgba(201, 168, 76, 0.45);
  border-radius: 999px;
  color: var(--gold-bright);
  font-family: var(--font-serif);
  font-size: var(--fs-aux);
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  text-decoration: none;
  transition: border-color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
}

.story-entry:hover {
  border-color: var(--gold-bright);
  background: rgba(201, 168, 76, 0.1);
  box-shadow: 0 0 22px rgba(201, 168, 76, 0.2);
}

/* ---------- 滚动浮现 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 中屏（平板/折叠屏展开态） ---------- */
/* 正文 br 断行在 641-1024 区间隐藏：两行近似等宽会形成方块感、失去居中观感，
   合并为整句一行保持居中对称；桌面 1280 以上保留两行诗式断行 */
@media (max-width: 1024px) {
  .chapter-text br { display: none; }
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  /* 手机竖屏裁剪横图会切掉两侧人物，首屏改用主体居中的名场面，并锚定泰罗俯身伸手的主体 */
  #hero {
    background:
      url("../assets/scene_parting.jpg") 63% 42% / cover no-repeat,
      var(--bg-mid);
  }

  .hero-veil {
    background:
      linear-gradient(180deg,
        rgba(5, 7, 15, 0.66) 0%,
        rgba(5, 7, 15, 0.22) 34%,
        rgba(5, 7, 15, 0.30) 62%,
        rgba(5, 7, 15, 0.95) 100%),
      radial-gradient(ellipse at center,
        transparent 46%,
        rgba(5, 7, 15, 0.48) 100%);
  }

  .hero-title {
    font-size: clamp(26px, 7vw, 34px);
    letter-spacing: 0.12em;
    text-indent: 0.12em;
    white-space: nowrap;
  }

  /* 观景页章节标题：缩小字号并锁定一行，手机竖屏不再折行 */
  .chapter-title {
    font-size: 20px;
    letter-spacing: 0.26em;
    text-indent: 0.26em;
    white-space: nowrap;
  }

  .portrait-grid {
    grid-template-columns: 1fr;
    gap: 52px;
    max-width: 400px;
  }

  .scene { height: min(64vh, 520px); }
  .chapter-body { margin-top: -74px; }
  .chapter-text br { display: none; }
  .traits li { padding: 3px 8px; }
}

/* ---------- 减弱动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-inner, .loader-orb, .loader-text, #cert-btn, .scroll-hint span {
    animation: none;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- 声音开关（audio.js 注入，两页共用） ---------- */
#audio-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70; /* 高于认证卡弹层（60），弹层打开时仍可静音 */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(7, 11, 24, 0.55);
  border: 1px solid rgba(201, 168, 76, 0.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

#audio-toggle:hover {
  border-color: rgba(201, 168, 76, 0.7);
  box-shadow: 0 0 18px rgba(201, 168, 76, 0.22);
}

.audio-bars {
  display: flex;
  align-items: center;
  height: 18px;
}

.audio-bars i {
  display: block;
  width: 2.5px;
  height: 18px;
  margin: 0 2.5px;
  border-radius: 2px;
  background: var(--gold);
  transform-origin: center;
  animation: audio-bar 1.5s ease-in-out infinite;
}

.audio-bars i:nth-child(2) { animation-delay: 0.25s; }
.audio-bars i:nth-child(3) { animation-delay: 0.5s; }

@keyframes audio-bar {
  0%, 100% { transform: scaleY(0.35); opacity: 0.6; }
  50%      { transform: scaleY(1);    opacity: 1; }
}

#audio-toggle.muted .audio-bars i {
  animation: none;
  transform: scaleY(0.28);
  opacity: 0.3;
}
