/* =========================================================
   AMY & EMY · 提瓦特双生档案
   css/main.css — 设计变量 / 基础排版 / 布局骨架
   ========================================================= */

/* ---------- 设计令牌 ---------- */
:root {
  /* 夜色底色 */
  --ink-900: #050c15;
  --ink-800: #08131f;
  --ink-700: #0d1c2b;
  --ink-600: #12283d;
  --ink-500: #17354e;

  /* 提瓦特金 */
  --gold-100: #fdf3dc;
  --gold-200: #f8e6c0;
  --gold-300: #f0c987;
  --gold-400: #e8b45a;
  --gold-500: #c9953f;
  --gold-600: #9a6d2c;

  /* 元素青 */
  --teal-200: #b9f6f2;
  --teal-300: #7ff0e6;
  --teal-400: #4fd6e0;

  /* 角色主色 */
  --amy: #f2a0a0;
  --amy-soft: #ffd9c2;
  --amy-deep: #d97a7a;
  --emy: #5aa9e6;
  --emy-soft: #a8d8ff;
  --emy-deep: #3b7fc4;

  /* 当前共鸣元素（JS 切换） */
  --accent: var(--gold-300);
  --accent-soft: var(--gold-200);
  --accent-glow: rgba(240, 201, 135, 0.55);

  /* 文本 */
  --text: #f3ecdf;
  --text-dim: rgba(243, 236, 223, 0.68);
  --text-faint: rgba(243, 236, 223, 0.42);

  /* 字体 */
  --font-display: "Didot", "Bodoni 72", "Playfair Display", "Optima", "Songti SC", "STSong", "Noto Serif SC", serif;
  --font-cn: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* 尺寸 */
  --shell: 1280px;
  --gutter: clamp(20px, 4vw, 56px);

  /* 动效 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 0.28s;
  --t-mid: 0.6s;
  --t-slow: 1.1s;
}

/* 元素主题（由 JS 设置 data-el 属性切换） */
body[data-el="pyro"]    { --accent: #ff9a62; --accent-soft: #ffd0a8; --accent-glow: rgba(255,154,98,.55); }
body[data-el="cryo"]    { --accent: #8fe3ff; --accent-soft: #d8f4ff; --accent-glow: rgba(143,227,255,.55); }
body[data-el="hydro"]   { --accent: #5aa9e6; --accent-soft: #a8d8ff; --accent-glow: rgba(90,169,230,.55); }
body[data-el="anemo"]   { --accent: #7fe3b0; --accent-soft: #c9f7de; --accent-glow: rgba(127,227,176,.55); }
body[data-el="electro"] { --accent: #b79bff; --accent-soft: #ddd0ff; --accent-glow: rgba(183,155,255,.55); }
body[data-el="dendro"]  { --accent: #a5d94a; --accent-soft: #ddf3b0; --accent-glow: rgba(165,217,74,.55); }
body[data-el="geo"]     { --accent: #e8b45a; --accent-soft: #f8e6c0; --accent-glow: rgba(232,180,90,.55); }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink-900);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-locked { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }

::selection {
  background: var(--accent);
  color: var(--ink-900);
}

/* 滚动条 */
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--ink-900); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold-500), var(--gold-300));
  border-radius: 99px;
  border: 2px solid var(--ink-900);
}
::-webkit-scrollbar-thumb:hover { background: var(--gold-300); }

/* ---------- 载入画面 ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(20, 52, 74, 0.95), rgba(5, 12, 21, 0.99) 70%),
    var(--ink-900);
  transition: opacity 0.9s var(--ease-out), visibility 0.9s;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }

.loader__ring {
  position: absolute;
  width: 190px; height: 190px;
  border: 1px solid rgba(240, 201, 135, 0.22);
  border-radius: 50%;
  border-top-color: var(--gold-300);
  border-right-color: rgba(240, 201, 135, 0.55);
  animation: spin 2.4s linear infinite;
}
.loader__ring::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(240, 201, 135, 0.14);
  border-radius: 50%;
  border-bottom-color: var(--teal-300);
  animation: spin 3.6s linear infinite reverse;
}

.loader__star { width: 86px; height: 86px; }
.loader__star svg { width: 100%; height: 100%; fill: var(--gold-200); filter: drop-shadow(0 0 18px rgba(240,201,135,.75)); animation: pulseStar 2.6s var(--ease-soft) infinite; }

.loader__bar {
  width: 210px; height: 2px;
  background: rgba(240, 201, 135, 0.15);
  overflow: hidden;
}
.loader__bar i {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--gold-300), transparent);
  animation: loaderSlide 1.25s var(--ease-soft) infinite;
}
.loader__text {
  font-family: var(--font-cn);
  font-size: 13px;
  letter-spacing: 0.4em;
  color: var(--text-dim);
  text-indent: 0.4em;
}

/* ---------- 全局特效层 ---------- */
.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 42%, rgba(3, 8, 14, 0.42) 88%, rgba(3, 8, 14, 0.72) 100%);
  mix-blend-mode: multiply;
}

.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 460px; height: 460px;
  margin: -230px 0 0 -230px;
  z-index: 1;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 62%);
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
  mix-blend-mode: screen;
}
.cursor-glow.is-on { opacity: 0.42; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px var(--gutter);
  transition: background 0.5s var(--ease-out), backdrop-filter 0.5s, border-color 0.5s;
  border-bottom: 1px solid transparent;
}
.topbar.is-stuck {
  background: rgba(5, 12, 21, 0.72);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: rgba(240, 201, 135, 0.16);
}
.topbar__brand { display: flex; align-items: center; gap: 11px; }
.topbar__mark { width: 22px; height: 22px; display: block; }
.topbar__mark svg { width: 100%; height: 100%; fill: var(--gold-300); filter: drop-shadow(0 0 8px rgba(240,201,135,.7)); animation: pulseStar 4s var(--ease-soft) infinite; }
.topbar__name {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.34em;
  color: var(--gold-200);
}
.topbar__name i { font-style: normal; color: var(--gold-500); }
.topbar__nav { display: flex; gap: 26px; }
.topbar__nav a {
  font-size: 12.5px;
  letter-spacing: 0.24em;
  color: var(--text-dim);
  position: relative;
  padding-bottom: 3px;
  transition: color var(--t-fast);
}
.topbar__nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--gold-300);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}
.topbar__nav a:hover { color: var(--gold-200); }
.topbar__nav a:hover::after { transform: scaleX(1); }

/* ---------- 元素共鸣选择器 ---------- */
.resonance {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 38;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 18px 9px 20px;
  border-radius: 99px;
  background: rgba(8, 19, 31, 0.62);
  border: 1px solid rgba(240, 201, 135, 0.2);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.resonance__label {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--text-faint);
  white-space: nowrap;
}
.resonance__row { display: flex; gap: 6px; }
.elem-btn {
  position: relative;
  width: 36px; height: 36px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: transform 0.4s var(--ease-out), border-color 0.4s, background 0.4s, box-shadow 0.4s;
  -webkit-tap-highlight-color: transparent;
}
.elem-btn img {
  width: 100%; height: 100%;
  object-fit: contain;
  opacity: 0.5;
  filter: grayscale(1) brightness(1.5);
  transition: opacity 0.4s, filter 0.4s, transform 0.4s var(--ease-out);
}
.elem-btn:hover { transform: translateY(-4px) scale(1.12); border-color: rgba(240, 201, 135, 0.35); }
.elem-btn:hover img { opacity: 0.95; filter: grayscale(0) brightness(1.1); }
.elem-btn.is-active {
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}
.elem-btn.is-active img { opacity: 1; filter: none; transform: scale(1.1); }

/* ---------- 通用区块 ---------- */
.section {
  position: relative;
  z-index: 4;
  padding: clamp(90px, 12vw, 150px) var(--gutter);
}
.section__head { text-align: center; margin-bottom: clamp(46px, 6vw, 76px); }
.section__kicker {
  font-size: 11px;
  letter-spacing: 0.46em;
  text-indent: 0.46em;
  color: var(--accent);
  margin-bottom: 14px;
  transition: color var(--t-mid);
}
.section__title {
  font-family: var(--font-cn);
  font-size: clamp(30px, 5.2vw, 52px);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  background: linear-gradient(180deg, #fff8e8 0%, var(--gold-300) 46%, var(--gold-500) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 24px rgba(240, 201, 135, 0.28));
}

/* ---------- 装饰分隔线 ---------- */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}
.ornament__line {
  height: 1px;
  width: clamp(70px, 14vw, 170px);
  background: linear-gradient(90deg, transparent, var(--gold-500));
  position: relative;
}
.ornament__line:last-child { background: linear-gradient(90deg, var(--gold-500), transparent); }
.ornament__line::after {
  content: "";
  position: absolute;
  top: 50%; right: -3px;
  width: 5px; height: 5px;
  transform: translateY(-50%) rotate(45deg);
  background: var(--gold-400);
}
.ornament__line:last-child::after { right: auto; left: -3px; }
.ornament__star { width: 17px; height: 17px; fill: var(--gold-300); filter: drop-shadow(0 0 8px rgba(240,201,135,.6)); animation: pulseStar 3.4s var(--ease-soft) infinite; }
.ornament--sm .ornament__star { width: 13px; height: 13px; }

/* ---------- 滚动揭示 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(38px);
  transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- 基础动效关键帧 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseStar {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.72; transform: scale(0.94); }
}
@keyframes loaderSlide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
@keyframes spinSlow { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .resonance { left: 12px; right: 12px; transform: none; justify-content: center; gap: 10px; padding: 8px 12px; }
  .resonance__label { display: none; }
  .elem-btn { width: 30px; height: 30px; }
  .topbar__nav { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
