/* ============================================================
   依依 · 二次元个人主页样式
   高级写法：CSS 变量 / 毛玻璃 / 渐变 / keyframes 动画
   / Scroll-driven 动画 / 响应式 / 平滑滚动
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  --c-bg: #fbf8f5;
  --c-ink: #26262e;
  --c-mut: #8a8a99;
  --c-brand: #66ccff;
  --c-brand-d: #2e90d9;
  --c-accent: #ffc107;
  --c-card: rgba(255, 255, 255, .72);
  --c-card-border: rgba(255, 255, 255, .5);
  --glass: saturate(180%) blur(18px);
  --shadow: 0 20px 60px rgba(40, 60, 80, .12);
  --radius: 22px;
  --maxw: 1120px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--c-ink);
  background: var(--c-bg);
  line-height: 1.7;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* 滚动条 - 默认隐藏(首页全屏), 滚动后(scrolling)显示(电脑/手机一致) */
::-webkit-scrollbar { width: 0; height: 0; }
::-webkit-scrollbar-thumb { background: rgba(46,144,217,.4); border-radius: 8px; }
html.scrolling::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* 选中文字 */
::selection { background: var(--c-brand); color: #fff; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  background: var(--c-bg);
  overflow: hidden;
}
/* 满屏背景 - 渐变淡入淡出轮播 */
.hero-slider { position: absolute; inset: 0; }
.slide-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.4s var(--ease), transform 6s var(--ease);
}
.slide-bg.active { opacity: 1; transform: scale(1); }
.slide-bg[data-img="hero"]   { background-image: url("../img/hero.jpg"); }
.slide-bg[data-img="mobile"] { background-image: url("../img/mobile.jpg"); background-position: center 15%; }
.slide-bg[data-img="tale"]   { background-image: url("../img/tale.jpg"); }
.slide-bg[data-img="slide4"] { background-image: url("../img/slide4.jpg"); }
.hero-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 30, 60, .55) 0%, rgba(20, 30, 60, .25) 40%, rgba(18, 26, 50, .72) 100%),
    radial-gradient(ellipse at 20% 20%, rgba(102, 204, 255, .25), transparent 55%);
}

/* 导航 - 圆角悬浮胶囊玻璃导航(清亮不透黑, 无黑边) */
.nav {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px 10px 10px;
  z-index: 1000;
  border-radius: 999px;
  width: max-content; max-width: calc(100% - 24px);
  background: radial-gradient(120% 170% at 50% 0%, rgba(255,255,255,.40), rgba(255,255,255,.24) 55%, rgba(255,255,255,.16));
  backdrop-filter: blur(20px) saturate(175%) brightness(1.25); -webkit-backdrop-filter: blur(20px) saturate(175%) brightness(1.25);
  border: 1px solid rgba(255,255,255,.4);
  box-shadow: 0 12px 36px rgba(40,80,120,.16), inset 0 1px 0 rgba(255,255,255,.5);
  transition: background .4s, box-shadow .4s, backdrop-filter .4s, opacity .5s var(--ease), transform .5s var(--ease);
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.nav::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.30), rgba(255,255,255,0) 55%);
  pointer-events: none;
}
.nav::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 14px rgba(255,255,255,.14);
  pointer-events: none;
}

.nav.scrolled {
  background: radial-gradient(120% 170% at 50% 0%, rgba(255,255,255,.62), rgba(255,255,255,.42) 55%, rgba(255,255,255,.32));
  box-shadow: 0 12px 44px rgba(8,16,34,.22), inset 0 1px 0 rgba(255,255,255,.6);
}
/* 滚动到浅色内容区时: 文字转深色, 保持无黑边, 对比清晰 */
.nav.scrolled .nav-links a { color: #0f2248; font-weight: 700; }
.nav.scrolled .nav-links a:hover,
.nav.scrolled .nav-links a.active {
  background: rgba(46,144,217,.18); color: #0d2b50;
}
.brand {
  font-weight: 900; font-size: 1.15rem; letter-spacing: .5px;
  padding: 8px 16px; border-radius: 999px;
  background: linear-gradient(135deg, var(--c-brand), var(--c-brand-d)); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
  white-space: nowrap;
}
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  position: relative;
  font-size: .95rem; font-weight: 600; opacity: .95;
  padding: 10px 18px; border-radius: 999px;
  color: #1d2b52;
  transition: background .3s var(--ease), color .3s, transform .3s;
  white-space: nowrap;
}
.nav-links a::after {
  content: ""; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 0; height: 3px; border-radius: 3px;
  background: var(--c-brand-d);
  transition: width .35s var(--ease);
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(46,144,217,.16); color: #12365c; opacity: 1;
  transform: translateY(-1px);
}
.nav-links a:hover::after, .nav-links a.active::after { width: 18px; }

/* 主区内容 */
.hero-content { position: relative; z-index: 2; padding-top: 80px; max-width: 900px; }
.hero-kicker {
  display: inline-block;
  padding: 6px 16px; margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 999px;
  font-size: .85rem; letter-spacing: 2px;
  color: #fff;
  background: transparent;
  text-shadow: 0 1px 8px rgba(0,0,0,.35);
}
.hero-title {
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  font-weight: 900; line-height: 1.15; letter-spacing: 1px;
  text-shadow: 0 6px 30px rgba(0, 0, 0, .4);
  animation: fadeUp 1s var(--ease) both, glitch 6s .5s infinite;
}
/* 打字机 */
.hero-typing {
  margin-top: 18px; min-height: 1.6em;
  font-size: 1.3rem; color: var(--c-brand);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .5);
}
.cursor { animation: blink .8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-sub { margin-top: 14px; max-width: 540px; color: rgba(255, 255, 255, .85); font-size: 1.05rem; }
.hero-cta { display: flex; gap: 16px; margin-top: 34px; flex-wrap: wrap; }

.btn {
  padding: 13px 30px; border-radius: 999px; font-weight: 700; font-size: .98rem;
  transition: transform .3s var(--ease), box-shadow .3s, background .3s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--c-brand), var(--c-brand-d));
  color: #fff; box-shadow: 0 10px 30px rgba(46, 144, 217, .4);
}
.btn-primary:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(46, 144, 217, .5); }
.btn-ghost { border: 1.5px solid rgba(255,255,255,.5); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.15); transform: translateY(-4px); }

/* 滚动提示 */
.scroll-hint {
  position: absolute; bottom: 30px; left: 0; right: 0; margin: 0 auto;
  width: 100%; text-align: center; z-index: 2; pointer-events: none;
}
/* 滚动条整体在容器中水平居中: 用 inline-flex 包裹 */
.scroll-hint span {
  display: inline-flex; justify-content: center; align-items: flex-start;
  width: 26px; height: 46px;
  border: 2px solid rgba(255,255,255,.55); border-radius: 15px;
  position: relative; margin: 0 auto;
}
.scroll-hint span::before {
  content: ""; position: absolute; top: 9px; left: 50%; margin-left: -2.5px;
  width: 5px; height: 9px; border-radius: 5px; background: #fff;
  animation: scrollDot 1.6s var(--ease) infinite;
}
@keyframes scrollDot {
  0%   { transform: translateY(0); opacity: 1; }
  70%  { transform: translateY(16px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ============================================================
   通用 section
   ============================================================ */
.section { padding: 110px 24px; }
.section-tag {
  color: var(--c-brand-d); font-weight: 700; font-size: .9rem;
  letter-spacing: 3px; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 10px;
}
.section-tag::before { content: ""; width: 26px; height: 2px; background: var(--c-brand-d); }
.section-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 900;
  margin-top: 8px; margin-bottom: 52px; letter-spacing: 1px;
}

/* 滚动显现动画（配合 JS IntersectionObserver）
   仅当 JS 可用时(html.js)才初始隐藏,否则内容始终可见(优雅降级) */
html.js .reveal { opacity: 0; transform: translateY(38px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
html.js .reveal.in { opacity: 1; transform: none; }

/* ============ ABOUT ============ */
.about-grid {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 60px; align-items: center;
}
.about-img { position: relative; }
.img-frame {
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}
.img-frame img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform .8s var(--ease); }
.about-img:hover .img-frame img { transform: scale(1.06); }
/* 拟真相框圆角偏移装饰 */
.img-frame::after {
  content: ""; position: absolute; inset: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3), inset 0 0 60px rgba(102,204,255,.12);
}
.float-badge {
  position: absolute; right: -18px; bottom: 24px;
  padding: 10px 18px; border-radius: 14px;
  background: #fff;
  color: var(--c-brand-d); font-weight: 800;
  box-shadow: var(--shadow);
  animation: floatY 4s ease-in-out infinite;
}
@keyframes floatY { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-10px);} }

.about-text h3 { font-size: 1.7rem; font-weight: 900; margin-bottom: 16px; }
.about-text p { color: #5a5a68; margin-bottom: 14px; }
.about-list { margin-top: 20px; display: grid; gap: 12px; }
.about-list li { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.dot {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--c-brand), var(--c-brand-d));
  box-shadow: 0 0 0 4px rgba(102, 204, 255, .25);
}

/* ============ SKILLS ============ */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 26px; }
.skill-card {
  position: relative;
  background: linear-gradient(150deg, #b8e6ff, #daF2ff 45%, #eaf8ff);
  border-radius: 20px; padding: 30px 26px;
  border: 1px solid #9edcf8;
  box-shadow: 0 10px 28px rgba(64,180,230,.18);
  overflow: hidden;
  transition: transform .4s var(--ease), box-shadow .4s;
}
.skill-card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(40,80,110,.16); }
.skill-icon { font-size: 2rem; margin-bottom: 12px; }
.skill-card h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 14px; color: #163a5f; }
.skill-card p { color: #3c4a5c; font-size: .93rem; font-weight: 500; margin-top: 12px; }
.bar {
  height: 8px; border-radius: 8px; background: rgba(102,204,255,.15); overflow: hidden;
}
.bar-fill {
  display: block; height: 100%; width: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--c-brand), var(--c-brand-d));
  transition: width 1.2s var(--ease);
}

/* ============ GALLERY ============ */
.gallery-lead { color: var(--c-mut); max-width: 520px; margin: -36px 0 40px; }
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px;
}
.g-item {
  position: relative; border-radius: 22px; overflow: hidden; cursor: pointer;
  aspect-ratio: 4 / 3;
  box-shadow: 0 10px 30px rgba(40,60,80,.14), inset 0 0 0 1px rgba(255,255,255,.2);
  background: rgba(255,255,255,.1);
  transition: transform .5s var(--ease), box-shadow .5s;
}
.g-item::before {
  content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit;
  background: linear-gradient(160deg, rgba(255,255,255,.4), transparent 55%);
  opacity: 0; transition: opacity .5s; pointer-events: none;
}
.g-item:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 24px 60px rgba(30,60,90,.3), inset 0 0 0 1px rgba(255,255,255,.4);
}
.g-item:hover::before { opacity: 1; }
.g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), filter .6s; }
.g-item:hover img { transform: scale(1.1); filter: saturate(1.25) brightness(.92); }
.g-cap {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(180deg, transparent, rgba(20,34,60,.6));
  color: #fff; font-size: 1.6rem; opacity: 0;
  transition: opacity .4s var(--ease);
}
.g-item:hover .g-cap { opacity: 1; }

/* (联系区已移除,避免信息泄露) */

/* ============ 返回首页按钮 ============ */
#backToTop {
  position: fixed; right: 26px; bottom: 30px;
  width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
  background: linear-gradient(150deg, rgba(34,48,84,.78), rgba(20,28,52,.66));
  backdrop-filter: blur(14px) saturate(150%); -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow: 0 10px 30px rgba(8,16,34,.35), inset 0 1px 0 rgba(255,255,255,.28);
  cursor: pointer;
  opacity: 0; visibility: hidden;
  transform: translateY(16px);
  transition: opacity .4s var(--ease), transform .4s var(--ease), visibility .4s, background .3s;
  z-index: 999;
}
#backToTop.show { opacity: 1; visibility: visible; transform: translateY(0); }
#backToTop:hover {
  background: linear-gradient(150deg, rgba(56,74,120,.85), rgba(30,42,74,.7));
  transform: translateY(-3px);
}

.footer {
  background: linear-gradient(180deg, #141a32, #0d1222);
  color: rgba(255,255,255,.7); text-align: center;
  padding: 50px 24px 42px;
}
.footer-text { font-size: 1rem; margin-bottom: 12px; }
.footer-icp a {
  color: rgba(255,255,255,.5); font-size: .85rem;
  transition: color .3s;
}
.footer-icp a:hover { color: var(--c-brand); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .nav { top: 12px; padding: 6px 8px; }
  .nav-links { gap: 0; font-size: .86rem; }
  .nav-links a { padding: 8px 11px; }
  .brand { font-size: 1rem; padding: 7px 12px; }
  .hero-content { padding-top: 130px; }
  .section { padding: 80px 20px; }
}
@media (max-width: 480px) {
  .nav { flex-wrap: nowrap; max-width: calc(100% - 20px); }
  .nav-links a { font-size: .8rem; padding: 7px 8px; }
  .brand { display: none; }  /* 窄屏隐藏brand,给链接让位 */
  /* 手机端 hero 专属优化 */
  .hero-content { padding-top: 120px; padding-left: 18px; padding-right: 18px; }
  .hero-title {
    font-size: 1.7rem;
    line-height: 1.3;
    word-break: break-word;
    letter-spacing: .5px;
  }
  .hero-kicker { font-size: .78rem; padding: 5px 12px; }
  .hero-sub { font-size: .95rem; line-height: 1.6; max-width: 100%; }
  .hero-typing { font-size: 1.05rem; }
  /* 按钮: 居中对齐不歪, 宽度统一, 避开滚动提示 */
  .hero-cta {
    flex-direction: column; align-items: center; gap: 12px; margin: 26px auto 0;
    max-width: 240px;
  }
  .hero-cta .btn { width: 100%; max-width: 240px; justify-content: center; }
  .btn { padding: 14px 24px; font-size: 1rem; min-height: 48px; }
  /* 滚动提示: 手机上移一点, 避免和按钮重叠 */
  .scroll-hint { bottom: 20px; }
  .scroll-hint span { width: 22px; height: 36px; }
  /* 矮屏(小屏手机/横放): 隐藏滚动提示, 避免和按钮抢位置 */
  @media (max-height: 700px) {
    .scroll-hint { display: none; }
    .hero-content { padding-top: 104px; }
  }
}
@media (max-width: 820px) and (min-width: 481px) {
  .hero-title { font-size: 2.4rem; word-break: break-word; }
  .hero-sub { font-size: 1rem; }
  .btn { min-height: 48px; padding: 13px 26px; }
}

/* 设备专属适配: 手机端标题更大 + 更强的液态玻璃 */
html.is-phone .hero-title { font-size: 2.1rem; }
html.is-phone .hero-kicker { font-size: .82rem; }
html.is-phone .hero-sub { font-size: 1.02rem; line-height: 1.6; }
html.is-phone .hero-typing { font-size: 1.15rem; }
/* 手机端液态玻璃增强(导航/返回按钮) */
html.is-phone .nav,
html.is-phone .nav.scrolled {
  backdrop-filter: blur(24px) saturate(200%) brightness(1.35); -webkit-backdrop-filter: blur(24px) saturate(200%) brightness(1.35);
}
html.is-phone #backToTop {
  backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%);
}
html.is-touch .btn, html.is-touch .nav-links a { -webkit-tap-highlight-color: transparent; }

/* 精简动画：减少动态偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
