/* ============================================================
   Z Jiang 的 AI 作品集 · 哈利波特魔法风格
   ============================================================ */

:root {
  --bg-deep: #0b0820;
  --bg-card: rgba(16, 12, 44, 0.62);
  --bg-card-hover: rgba(24, 18, 58, 0.78);
  --gold: #f2c14e;
  --gold-light: #ffe9a8;
  --violet: #a78bfa;
  --teal: #2dd4bf;
  --text: #ece7ff;
  --text-dim: #b6aede;
  --border: rgba(180, 150, 255, 0.22);
  --font-display: "Cinzel Decorative", "Noto Sans SC", serif;
  --font-body: "Cormorant Garamond", "Noto Sans SC", serif;
  --font-cn: "Noto Sans SC", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-cn);
  color: var(--text);
  background: var(--bg-deep);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================================
   背景层：城堡照片 + Vanta 动态魔法雾 + 光晕 + 飞行物
   ============================================================ */
.bg-scene {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -2;
  overflow: hidden;
  background: var(--bg-deep);
}

.bg-img {
  position: absolute;
  top: -2%;
  right: -2%;
  bottom: -2%;
  left: -2%;
  background: url("assets/hogwarts-bg.jpg") center / cover no-repeat;
  animation: bg-drift 40s ease-in-out infinite alternate;
  filter: brightness(1.15) contrast(1.12) saturate(1.1);
}

@keyframes bg-drift {
  0%   { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.08) translate(-1.5%, 1.5%); }
}

.bg-vanta {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  opacity: 0.28;
  mix-blend-mode: screen;
}

.bg-vignette {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background:
    radial-gradient(120% 90% at 50% 12%, rgba(15, 8, 45, 0.06) 0%, rgba(10, 6, 32, 0.38) 55%, rgba(6, 4, 20, 0.82) 100%),
    linear-gradient(180deg, rgba(10, 6, 32, 0.28) 0%, rgba(10, 6, 32, 0.02) 35%, rgba(8, 5, 26, 0.22) 70%, rgba(6, 4, 18, 0.82) 100%);
}

/* 飞行层（扫帚 + 金色飞贼） */
.magic-layer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
}

/* ---------- 飞天扫帚 ---------- */
.broom {
  position: absolute;
  left: -18vw;
  will-change: transform;
  opacity: 0;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 18px rgba(255, 220, 130, 0.25));
}

.broom svg {
  display: block;
  width: 64px;
  height: auto;
}

.broom::after {
  /* 尾迹 */
  content: "";
  position: absolute;
  top: 55%;
  right: 96%;
  width: 70px;
  height: 6px;
  background: linear-gradient(90deg, rgba(255, 235, 170, 0.55), rgba(242, 193, 78, 0.28), transparent);
  border-radius: 50%;
  filter: blur(3px);
  opacity: 0.8;
}

.broom-1 { animation: fly1 var(--fly-dur, 30s) linear var(--fly-delay, 0s) infinite; }
.broom-2 { animation: fly2 var(--fly-dur, 36s) linear var(--fly-delay, -12s) infinite; }
.broom-3 { animation: fly3 var(--fly-dur, 44s) linear var(--fly-delay, -26s) infinite; }

@keyframes fly1 {
  0%   { transform: translate(-20vw, 78vh) rotate(38deg) scale(var(--fly-scale, 1)); opacity: 0; }
  8%   { opacity: 1; }
  60%  { transform: translate(46vw, 48vh) rotate(32deg) scale(var(--fly-scale, 1)); }
  92%  { opacity: 1; }
  100% { transform: translate(118vw, 14vh) rotate(36deg) scale(var(--fly-scale, 1)); opacity: 0; }
}

@keyframes fly2 {
  0%   { transform: translate(-18vw, 92vh) rotate(40deg) scale(var(--fly-scale, 1)); opacity: 0; }
  10%  { opacity: 1; }
  55%  { transform: translate(38vw, 66vh) rotate(30deg) scale(var(--fly-scale, 1)); }
  90%  { opacity: 1; }
  100% { transform: translate(115vw, 26vh) rotate(38deg) scale(var(--fly-scale, 1)); opacity: 0; }
}

@keyframes fly3 {
  0%   { transform: translate(-16vw, 66vh) rotate(34deg) scale(var(--fly-scale, 1)); opacity: 0; }
  10%  { opacity: 1; }
  50%  { transform: translate(52vw, 40vh) rotate(44deg) scale(var(--fly-scale, 1)); }
  90%  { opacity: 1; }
  100% { transform: translate(116vw, 6vh) rotate(38deg) scale(var(--fly-scale, 1)); opacity: 0; }
}

/* ---------- 金色飞贼 ---------- */
.snitch {
  position: absolute;
  width: 26px;
  height: 26px;
  will-change: transform;
  opacity: 0;
}

.snitch-body {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7cf, #f2c14e 55%, #b8860b);
  box-shadow: 0 0 10px 3px rgba(242, 193, 78, 0.85), 0 0 26px 8px rgba(242, 193, 78, 0.35);
  animation: snitch-pulse 2.2s ease-in-out infinite;
}

.snitch-wing {
  position: absolute;
  top: 5px;
  width: 15px;
  height: 6px;
  background: rgba(248, 250, 252, 0.9);
  border-radius: 8px 2px 2px 8px;
  transform-origin: right center;
  animation: flap 0.28s ease-in-out infinite alternate;
}

.snitch-wing.sl { right: 100%; margin-right: 1px; }
.snitch-wing.sr { left: 100%; margin-left: 1px; transform-origin: left center; animation-direction: alternate-reverse; }

@keyframes flap {
  from { transform: rotate(14deg) scaleY(1); }
  to   { transform: rotate(-14deg) scaleY(0.85); }
}

@keyframes snitch-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50%      { transform: scale(1.08); filter: brightness(1.18); }
}

.snitch-1 { animation: snitchPath1 var(--snitch-dur, 16s) ease-in-out var(--snitch-delay, 0s) infinite; }
.snitch-2 { animation: snitchPath2 var(--snitch-dur, 20s) ease-in-out var(--snitch-delay, -6s) infinite; }
.snitch-3 { animation: snitchPath3 var(--snitch-dur, 24s) ease-in-out var(--snitch-delay, -12s) infinite; }
.snitch-4 { animation: snitchPath1 var(--snitch-dur, 27s) ease-in-out var(--snitch-delay, -19s) infinite reverse; }

@keyframes snitchPath1 {
  0%   { transform: translate(-6vw, 85vh); opacity: 0; }
  10%  { opacity: 1; }
  30%  { transform: translate(18vw, 62vh); }
  55%  { transform: translate(44vw, 76vh); }
  80%  { transform: translate(72vw, 48vh); }
  92%  { opacity: 1; }
  100% { transform: translate(106vw, 22vh); opacity: 0; }
}

@keyframes snitchPath2 {
  0%   { transform: translate(108vw, 18vh); opacity: 0; }
  12%  { opacity: 1; }
  38%  { transform: translate(70vw, 40vh); }
  62%  { transform: translate(38vw, 26vh); }
  85%  { transform: translate(10vw, 52vh); }
  94%  { opacity: 1; }
  100% { transform: translate(-8vw, 68vh); opacity: 0; }
}

@keyframes snitchPath3 {
  0%   { transform: translate(-8vw, 30vh); opacity: 0; }
  12%  { opacity: 1; }
  40%  { transform: translate(26vw, 12vh); }
  68%  { transform: translate(60vw, 34vh); }
  90%  { opacity: 1; }
  100% { transform: translate(110vw, 10vh); opacity: 0; }
}

/* ============================================================
   Hero 头部
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px 40px;
  text-align: center;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.avatar-wrap {
  position: relative;
  width: 190px;
  height: 190px;
  margin-bottom: 30px;
}

.avatar-wrap::before,
.avatar-wrap::after {
  content: "";
  position: absolute;
  top: -8px;
  right: -8px;
  bottom: -8px;
  left: -8px;
  border-radius: 50%;
  border: 2px solid rgba(242, 193, 78, 0.55);
  animation: ring-pulse 3.4s ease-out infinite;
}

.avatar-wrap::after {
  top: -20px;
  right: -20px;
  bottom: -20px;
  left: -20px;
  border-color: rgba(167, 139, 250, 0.4);
  animation-delay: 1.7s;
}

@keyframes ring-pulse {
  0%   { transform: scale(0.92); opacity: 0.9; }
  100% { transform: scale(1.18); opacity: 0; }
}

.avatar {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid rgba(242, 193, 78, 0.85);
  box-shadow:
    0 0 24px rgba(242, 193, 78, 0.5),
    0 0 60px rgba(167, 139, 250, 0.4),
    inset 0 0 18px rgba(255, 255, 255, 0.18);
}

.title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  /* 彩虹霓虹渐变文字 */
  background: linear-gradient(90deg,
      #ff6ec4, #a78bfa, #38bdf8, #4ade80,
      #fde047, #fb923c, #ff6ec4);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbow-flow 9s linear infinite;
  filter:
    drop-shadow(0 0 10px rgba(255, 255, 255, 0.28))
    drop-shadow(0 0 26px rgba(167, 139, 250, 0.55));
}

@keyframes rainbow-flow {
  0%   { background-position: 0% 0; }
  100% { background-position: 300% 0; }
}

.tagline {
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  font-family: var(--font-body);
  color: var(--gold-light);
  letter-spacing: 0.12em;
  text-shadow: 0 0 14px rgba(242, 193, 78, 0.6);
  margin-bottom: 26px;
}

.contact {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 26px;
  border-radius: 999px;
  font-size: 1.02rem;
  color: var(--gold-light);
  background: rgba(242, 193, 78, 0.08);
  border: 1px solid rgba(242, 193, 78, 0.45);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  box-shadow: 0 0 18px rgba(242, 193, 78, 0.18);
}

.contact:hover {
  background: rgba(242, 193, 78, 0.2);
  box-shadow: 0 0 28px rgba(242, 193, 78, 0.5);
  transform: translateY(-2px);
}

.contact-icon {
  font-size: 1.15rem;
}

/* 向下滚动提示 */
.scroll-hint {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 0.92rem;
  letter-spacing: 0.18em;
  transition: color 0.3s ease;
}

.scroll-hint:hover { color: var(--gold-light); }

.scroll-wand {
  font-size: 1.5rem;
  animation: wand-sway 2.6s ease-in-out infinite;
  display: inline-block;
}

@keyframes wand-sway {
  0%, 100% { transform: rotate(-16deg); }
  50%      { transform: rotate(16deg); }
}

.scroll-arrow {
  animation: arrow-bob 1.6s ease-in-out infinite;
}

@keyframes arrow-bob {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50%      { transform: translateY(7px); opacity: 1; }
}

/* ============================================================
   主体区块
   ============================================================ */
main {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.section {
  margin-bottom: 72px;
}

.section-title {
  font-family: var(--font-display);
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  color: var(--gold-light);
  text-shadow: 0 0 18px rgba(242, 193, 78, 0.55), 0 0 40px rgba(167, 139, 250, 0.35);
}

.title-orn {
  color: var(--violet);
  font-size: 0.7em;
  margin: 0 8px;
}

.section-sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.98rem;
  margin-bottom: 34px;
  letter-spacing: 0.05em;
}

/* ---------- 游戏分类块 ---------- */
.games-wrap {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.cat-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 22px 24px;
  backdrop-filter: blur(10px);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.cat-block:hover {
  border-color: var(--cat-color, var(--gold));
  box-shadow: 0 0 24px -6px var(--cat-color, var(--gold));
}

.cat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(180, 150, 255, 0.15);
}

.cat-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px var(--cat-color, var(--gold)));
}

.cat-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  color: var(--cat-color, var(--gold-light));
  text-shadow: 0 0 12px var(--cat-color, transparent);
}

.cat-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-dim);
  background: rgba(180, 150, 255, 0.12);
  border: 1px solid rgba(180, 150, 255, 0.2);
  padding: 2px 12px;
  border-radius: 999px;
}

.cat-games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

/* ---------- 游戏卡片：悬停发光 + 抬升 ---------- */
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    box-shadow 0.32s ease,
    border-color 0.32s ease,
    background 0.32s ease;
}

.game-card::before {
  /* 顶部魔法光线 */
  content: "";
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cat-color, var(--gold)), transparent);
  opacity: 0;
  transition: opacity 0.32s ease;
}

.game-card:hover {
  transform: translateY(-8px);
  background: var(--bg-card-hover);
  border-color: var(--cat-color, var(--gold));
  box-shadow:
    0 0 18px -2px var(--cat-color, var(--gold)),
    0 0 42px -8px var(--cat-color, var(--gold)),
    0 16px 30px rgba(0, 0, 0, 0.45);
}

.game-card:hover::before { opacity: 1; }

.game-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.game-arrow {
  color: var(--cat-color, var(--gold));
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  flex-shrink: 0;
}

.game-card:hover .game-arrow {
  opacity: 1;
  transform: translateX(0);
}

.game-desc {
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.55;
}

/* ---------- 学习园地 ---------- */
.learning-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.learn-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(242, 193, 78, 0.12), rgba(167, 139, 250, 0.12));
  border: 1px solid rgba(242, 193, 78, 0.35);
  overflow: hidden;
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    box-shadow 0.32s ease,
    border-color 0.32s ease;
}

.learn-card::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -30%;
  width: 70%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: rotate(18deg);
  transition: left 0.6s ease;
}

.learn-card:hover::after { left: 110%; }

.learn-card:hover {
  transform: translateY(-8px);
  border-color: var(--gold);
  box-shadow: 0 0 26px -4px rgba(242, 193, 78, 0.6), 0 16px 30px rgba(0, 0, 0, 0.4);
}

.learn-icon {
  font-size: 2.1rem;
  filter: drop-shadow(0 0 10px rgba(242, 193, 78, 0.6));
}

.learn-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 3px;
}

.learn-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ---------- 小实验（图标 + 文字卡片） ---------- */
.experiments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.exp-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    box-shadow 0.32s ease,
    border-color 0.32s ease,
    background 0.32s ease;
}

.exp-card:hover {
  transform: translateY(-6px);
  background: var(--bg-card-hover);
  border-color: var(--gold);
  box-shadow:
    0 0 18px -2px rgba(242, 193, 78, 0.55),
    0 0 38px -8px rgba(242, 193, 78, 0.4),
    0 14px 26px rgba(0, 0, 0, 0.45);
}

.exp-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  background: rgba(242, 193, 78, 0.1);
  border: 1px solid rgba(242, 193, 78, 0.35);
  border-radius: 12px;
  filter: drop-shadow(0 0 8px rgba(242, 193, 78, 0.35));
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.exp-card:hover .exp-icon {
  transform: scale(1.1) rotate(-6deg);
  box-shadow: 0 0 16px rgba(242, 193, 78, 0.45);
}

.exp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.exp-name {
  font-weight: 700;
  font-size: 1.02rem;
  color: #fff;
  font-family: var(--font-body);
}

.exp-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.exp-type {
  flex-shrink: 0;
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(242, 193, 78, 0.4);
  color: var(--gold-light);
  background: rgba(242, 193, 78, 0.08);
  letter-spacing: 0.04em;
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
  text-align: center;
  padding: 40px 20px 50px;
  color: var(--text-dim);
  font-size: 0.92rem;
  border-top: 1px solid rgba(180, 150, 255, 0.12);
  background: rgba(10, 6, 32, 0.5);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer a:hover { color: var(--gold-light); }

/* ============================================================
   滚动显现
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ============================================================
   响应式布局
   ============================================================ */
@media (max-width: 768px) {
  .hero { padding-top: 40px; }
  .avatar-wrap { width: 150px; height: 150px; }
  .section { margin-bottom: 52px; }
  .cat-games { grid-template-columns: 1fr 1fr; }
  .broom svg { width: 44px; }
  .broom::after { width: 46px; }
}

@media (max-width: 480px) {
  .cat-games { grid-template-columns: 1fr; }
  .cat-block { padding: 16px 14px 18px; }
  .title { letter-spacing: 0; }
  .contact { padding: 10px 18px; font-size: 0.92rem; }
}

@media (prefers-reduced-motion: reduce) {
  .broom, .snitch { display: none; }
  .bg-img, .title { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
