/* ==========================================================================
   yangqixi.cn · 主页样式
   架构：静态深色底 + 玻璃内容层 + 颗粒覆盖，动效全部由 GSAP/ScrollTrigger 编排
   主题：墨红黑编辑部风格，动效叙事（逐字入场 / 滚动视差 / 时间线画线 / 终端打字）
   ========================================================================== */

/* ---------- 字体 ---------- */
@font-face {
  font-family: 'LXGW WenKai';
  src: url('../fonts/LXGWWenKai-Medium.subset.woff2?v=20260905a') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* ---------- 设计 token ---------- */
:root {
  --font-display: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', 'KaiTi', serif;
  --font-body: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --font-mono: 'Cascadia Code', 'SF Mono', 'JetBrains Mono', Consolas, monospace;

  --radius-card: 16px;
  --radius-btn: 999px;
  --radius-input: 8px;
  --maxw: 1080px;
  --nav-h: 64px;

  /* 暗幕（默认）玻璃 */
  --glass-bg: rgba(255, 255, 255, 0.075);
  --glass-bg-strong: rgba(255, 255, 255, 0.11);
  --glass-border: rgba(255, 255, 255, 0.26);
  --glass-blur: 16px;
  --text: #F5F2EC;
  --text-dim: rgba(245, 242, 236, 0.64);
  --shadow: 0 24px 60px rgba(6, 3, 8, 0.35);
  --accent: #E05548;

  --z-bg: 0; --z-content: 10; --z-nav: 40; --z-grain: 50; --z-lb: 60;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 75% -8%, rgba(140, 31, 38, 0.16), transparent 70%),
    linear-gradient(180deg, #191114, #120d10 60%, #151013);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

::selection { background: rgba(224, 85, 72, 0.4); }

/* ---------- 环境氛围层：同色系柔光 + 细点阵（仅装饰，指针穿透） ---------- */
.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-glow {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.bg-glow.g1 {
  width: 58vw; height: 58vw;
  top: -18vw; right: -12vw;
  background: radial-gradient(closest-side, rgba(140, 31, 38, 0.30), transparent 72%);
}
.bg-glow.g2 {
  width: 52vw; height: 52vw;
  bottom: -18vw; left: -16vw;
  background: radial-gradient(closest-side, rgba(90, 20, 32, 0.36), transparent 72%);
}
.bg-glow.g3 {
  width: 34vw; height: 34vw;
  top: 40%; left: 24%;
  background: radial-gradient(closest-side, rgba(200, 106, 58, 0.13), transparent 70%);
}
.bg-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(245, 242, 236, 0.15) 1px, transparent 1.4px);
  background-size: 26px 26px;
  opacity: 0.32;
  -webkit-mask-image: radial-gradient(ellipse 95% 72% at 50% 36%, #000 0%, transparent 80%);
  mask-image: radial-gradient(ellipse 95% 72% at 50% 36%, #000 0%, transparent 80%);
}

/* ---------- 滚动进度细线 ---------- */
#progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: calc(var(--z-grain) + 10);
  background: linear-gradient(90deg, #C3272B, #E05548);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ---------- Hero 逐字入场遮罩 ---------- */
.char-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.char {
  display: inline-block;
  will-change: transform;
}

/* ---------- L2 颗粒 ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 玻璃基元 ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    var(--shadow);
  transition: background 1.8s ease, border-color 1.8s ease, box-shadow 1.8s ease, color 1.8s ease;
}

/* 降级：不支持/不偏好透明 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(24, 16, 20, 0.92); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass {
    background: rgba(24, 16, 20, 0.95);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* ---------- 导航 ---------- */
.site-nav {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--nav-h);
  padding: 0 26px;
  border-radius: var(--radius-btn);
  white-space: nowrap;
}
.site-nav a { white-space: nowrap; }
.section, #hero { scroll-margin-top: 84px; }
.site-nav.scrolled { background: var(--glass-bg-strong); }
.nav-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.12rem;
  text-decoration: none;
  letter-spacing: 0.06em;
}
.nav-links { display: flex; gap: 20px; }
.nav-links a {
  position: relative;
  font-size: 0.9rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.25s ease;
}
.nav-links a:hover, .nav-links a:focus-visible { color: var(--text); }
.nav-links a::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #E05548;
  opacity: 0;
  transform: translateX(-50%) scale(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { opacity: 1; transform: translateX(-50%) scale(1); }

/* ---------- Hero ---------- */
.hero {
  overflow: hidden;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 36px;
  padding: 110px 24px 56px;
  text-align: center;
  position: relative;
  z-index: var(--z-content);
}
.hero-mark {
  position: absolute;
  right: -3%;
  top: 6%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(190px, 34vw, 460px);
  line-height: 1;
  color: rgba(245, 242, 236, 0.032);
  pointer-events: none;
  user-select: none;
}
.hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.3rem, 5.6vw, 3.7rem);
  line-height: 1.16;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 26px rgba(0, 0, 0, 0.4);
}
.hero-sub {
  margin: 0;
  font-size: clamp(0.98rem, 2.2vw, 1.15rem);
  color: var(--text-dim);
  letter-spacing: 0.12em;
}
.hero-actions { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }

.btn {
  display: inline-block;
  padding: 13px 30px;
  border-radius: var(--radius-btn);
  font-size: 0.98rem;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.25s ease, background 1.8s ease, box-shadow 0.25s ease;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: #FFF7F2;
  box-shadow: 0 10px 30px rgba(140, 31, 38, 0.35);
}
.btn-primary:hover { box-shadow: 0 14px 36px rgba(140, 31, 38, 0.45); transform: translateY(-1px); }
.btn-ghost {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
}
.btn-ghost:hover { background: var(--glass-bg-strong); }

/* ---------- 板块通用 ---------- */
.section {
  position: relative;
  z-index: var(--z-content);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 108px 24px 40px;
}
.section-title {
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.section-title::before {
  content: '';
  flex: none;
  width: 4px;
  height: 1.02em;
  border-radius: 2px;
  background: linear-gradient(180deg, #C3272B, #E05548);
}
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  letter-spacing: 0.05em;
}
/* 标题上方红色细线（入场横向展开） */
.hero-rule {
  display: block;
  width: 64px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #C3272B, #E05548);
  margin-bottom: 6px;
}
.section-intro {
  margin: 0 0 30px;
  max-width: 65ch;
  color: var(--text-dim);
  transition: color 1.8s ease;
}

/* ---------- 关于我 ---------- */
.about-card { padding: 34px 36px; }
.about-text { margin: 0 0 22px; max-width: 62ch; }
.interest-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.interest-tag {
  font-size: 0.85rem;
  padding: 5px 16px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  text-decoration: none;
  transition: color 1.8s ease, border-color 1.8s ease, background 0.25s ease;
}
a.interest-tag:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.social-row { display: flex; gap: 12px; flex-wrap: wrap; }
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--glass-border);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.25s ease;
}
.social-link:hover { background: rgba(255, 255, 255, 0.09); transform: translateY(-1px); }

/* ---------- 我的应用（6 列制：每卡 2 列，3 + 2 居中，无空位）---------- */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: auto;
  gap: 18px;
}
.app-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 1.8s ease, border-color 1.8s ease;
}
.app-card:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 30px 70px rgba(6, 3, 8, 0.45);
}
.app-shot {
  margin: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.18);
}
.app-shot img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: top;
}
.app-info { padding: 18px 20px 20px; }
.app-info h3 {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: 0.04em;
}
.app-info h3::after {
  content: '↗';
  font-family: var(--font-body);
  font-size: 0.85em;
  font-weight: 400;
  color: var(--accent);
  opacity: 0;
  transform: translate(-6px, 6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.app-card:hover .app-info h3::after,
.app-card:focus-visible .app-info h3::after { opacity: 1; transform: translate(0, 0); }
.app-info p { margin: 0 0 12px; font-size: 0.88rem; color: var(--text-dim); transition: color 1.8s ease; }
.app-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.app-tags span {
  font-size: 0.72rem;
  padding: 3px 12px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
}

/* ---------- 摄影（瀑布流）---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.gallery-item {
  display: block;
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  aspect-ratio: 1;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  overflow: hidden;
  cursor: zoom-in;
  background: rgba(0, 0, 0, 0.15);
}
.g-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px 14px 11px;
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: left;
  color: #F5F2EC;
  background: linear-gradient(180deg, transparent, rgba(8, 5, 10, 0.78));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-card:active { transform: scale(0.98); }
.app-card:active { transition: transform 0.15s ease; }
.gallery-item:hover .g-cap,
.gallery-item:focus-visible .g-cap { opacity: 1; transform: translateY(0); }
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-fallback { color: var(--text-dim); }

/* ---------- 足迹 ---------- */
.path-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 18px;
  display: grid;
  gap: 14px;
  max-width: 720px;
  position: relative;
}
.path-line {
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, #C3272B, #E05548);
}
.path-node {
  display: flex;
  gap: 22px;
  align-items: baseline;
  padding: 20px 26px;
  transition: border-color 0.25s ease, box-shadow 0.3s ease, background 1.8s ease;
}
.path-node:hover {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 24px 60px rgba(6, 3, 8, 0.45);
}
.path-year {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  min-width: 3.6em;
  color: var(--accent);
  transition: color 1.8s ease;
}
.path-node h3 { margin: 0 0 4px; font-size: 1.02rem; letter-spacing: 0.05em; }
.path-node p { margin: 0; font-size: 0.9rem; color: var(--text-dim); transition: color 1.8s ease; }

/* ---------- 星门终端 ---------- */
.terminal {
  max-width: 720px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), var(--shadow), 0 0 90px rgba(195, 39, 43, 0.10);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.16);
}
.term-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--glass-border); }
.term-dot:first-child { background: #C3272B; }
.term-title { margin-left: 8px; font-size: 0.78rem; color: var(--text-dim); }
.term-body { padding: 20px 24px 24px; }
.term-body p { margin: 0 0 10px; }
.term-prompt { color: var(--accent); transition: color 1.8s ease; }
.term-out { color: var(--text-dim); }
.term-links { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.term-links a { color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--glass-border); }
.term-links a:hover { border-bottom-style: solid; }
.term-cursor {
  display: inline-block;
  width: 9px;
  height: 1.1em;
  vertical-align: text-bottom;
  background: var(--text);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 页脚 ---------- */
.site-footer {
  position: relative;
  z-index: var(--z-content);
  max-width: var(--maxw);
  margin: 40px auto 0;
  padding: 34px 24px 46px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.site-footer p { margin: 0 0 8px; }
.beian { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.beian a { color: var(--text-dim); text-decoration: none; }
.beian a:hover { color: var(--text); text-decoration: underline; }

/* ---------- 返回顶部 ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: calc(var(--z-nav) - 1);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.25s ease;
}
.to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.to-top:hover { background: var(--glass-bg-strong); }

/* ---------- 邮箱操作菜单 ---------- */
.mail-pop {
  position: fixed;
  z-index: calc(var(--z-nav) + 1);
  min-width: 218px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(24, 16, 20, 0.92);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), var(--shadow);
}
.mail-pop[hidden] { display: none; }
.mail-pop-addr {
  margin: 2px 6px 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  user-select: all;
}
.mail-pop button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}
.mail-pop button:hover, .mail-pop button:focus-visible { background: rgba(255, 255, 255, 0.09); outline: none; }
.mail-pop button.copied { color: #7BC496; }
.mail-pop button svg { flex: none; color: var(--text-dim); }
.mail-pop button.copied svg { color: #7BC496; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lb);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 4vmin;
  background: rgba(8, 5, 10, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: min(92vw, 1100px); max-height: 88vh; display: flex; flex-direction: column; }
.lightbox img { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: 6px; }
.lightbox figcaption { margin-top: 12px; text-align: center; font-size: 0.9rem; color: #E8E2D8; }
.lb-close, .lb-prev, .lb-next {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #F5F2EC;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.25s ease;
}
.lb-close, .lb-prev, .lb-next:hover { background: rgba(255, 255, 255, 0.18); }
.lb-close { position: absolute; top: 3vmin; right: 3vmin; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .apps-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .section { padding: 76px 18px 28px; }
  .site-nav { gap: 14px; padding: 0 16px; height: 54px; }
  .nav-logo { font-size: 1rem; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 0.8rem; }
  .apps-grid { grid-template-columns: 1fr; }
  .app-card { grid-column: auto; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .hero { padding: 96px 18px 44px; }
  .hero-mark { font-size: 240px; right: -12%; top: 3%; }
  .g-cap { font-size: 0.72rem; padding: 20px 11px 9px; }
  .path-node { flex-direction: column; gap: 6px; padding: 18px 20px; }
  .about-card { padding: 26px 22px; }
  .hero-actions .btn { padding: 12px 24px; font-size: 0.92rem; }
}

/* ---------- 降级与无障碍 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }

}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
