/* ============================================================
   Orange Way — 暗色质感主题
   全屏 WebGL 流动光带背景 + GSAP 滚动动效
   ============================================================ */

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

:root {
  --bg: #050508;
  --text: #f4f4f6;
  --muted: #9a9aa6;
  --line: rgba(255, 255, 255, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- 全屏流动光带（Three.js 画布） ---------- */
#hero-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.content {
  position: relative;
  z-index: 1;
}

/* ============================================================
   顶部导航
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: background 0.35s ease, border-color 0.35s ease;
  border-bottom: 1px solid transparent;
}

.nav.nav-scrolled {
  background: rgba(5, 5, 8, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--line);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.nav-logo-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4fb7ff, #ff9a3c);
  box-shadow: 0 0 14px rgba(79, 183, 255, 0.5);
}

.nav-logo-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.25s;
}

.nav-links a:hover {
  color: #ffffff;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  height: 100vh;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}

.hero-logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.35em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 28px;
}

.hero-title {
  font-size: clamp(34px, 6vw, 64px);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

/* 逐字字符：display 内联以便 transform 生效，初始/终点透明度由 GSAP 的 .from 控制 */
.hero-title .char,
#footerTitle .char {
  display: inline-block;
}

.hero-subtitle {
  margin-top: 26px;
  font-size: clamp(15px, 1.8vw, 18px);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.hero-actions {
  margin-top: 40px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 30px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.25s, background 0.25s, border-color 0.25s,
    box-shadow 0.25s;
  cursor: pointer;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #3ea6ff, #ff9a3c);
  color: #fff;
  box-shadow: 0 6px 24px rgba(62, 166, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
}

.btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   通用区块
   ============================================================ */
.section {
  padding: 120px 24px;
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.section-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
}

.section-desc {
  margin-top: 16px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

/* 卡片 */
.card-grid {
  margin-top: 52px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.card {
  display: block;
  text-align: left;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s, border-color 0.3s;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.2);
}

.card-cover {
  height: 130px;
  border-radius: 12px;
  margin-bottom: 16px;
  background: linear-gradient(
    135deg,
    hsl(var(--hue), 70%, 55%),
    hsl(calc(var(--hue) + 45), 70%, 30%)
  );
  opacity: 0.85;
}

.card-meta {
  font-size: 13px;
  color: var(--muted);
}

.card-title {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 700;
}

.card-meta span {
  margin-right: 12px;
}

.card-desc {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}

/* ============================================================
   项目 showcase
   ============================================================ */
.project-grid {
  margin-top: 52px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  text-align: left;
}

.project-card {
  display: block;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s, border-color 0.3s;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.2);
}

.project-cover {
  height: 130px;
  background: linear-gradient(
    135deg,
    hsl(var(--hue), 75%, 55%),
    hsl(calc(var(--hue) + 50), 75%, 26%)
  );
  opacity: 0.85;
}

.project-body {
  padding: 20px;
}

.project-name {
  font-size: 17px;
  font-weight: 700;
}

.project-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-tags span {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #cdd3e0;
}

.project-desc {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}

/* ============================================================
   联系我
   ============================================================ */
.contact-links {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

/* ============================================================
   Doodle 灵感墙
   ============================================================ */
.doodle-section {
  text-align: center;
}

.doodle-grid {
  margin-top: 52px;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.doodle-card {
  padding: 46px 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: #ffcb8a;
}

.doodle-card:nth-child(2) {
  color: #6fc2ff;
}

.doodle-card:nth-child(3) {
  color: #8fe0b8;
}

.doodle-card .month {
  font-size: 13px;
  opacity: 0.7;
}

.doodle-card h4 {
  margin-top: 12px;
  font-size: 30px;
}

/* ============================================================
   底部大 CTA
   ============================================================ */
.footer-cta {
  height: 100vh;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}

/* 与顶部 Hero 标题同款字体与颜色（纯色，不做渐变） */
.footer-cta h2 {
  font-size: clamp(34px, 6vw, 64px);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
  color: var(--text);
}

.footer-cta .hero-actions {
  margin-top: 40px;
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
  position: relative;
  z-index: 1;
  /* 渐变背景盖住底层流动光带，保证版权文字清晰可读 */
  background: linear-gradient(180deg, rgba(5, 5, 8, 0.45), rgba(4, 4, 7, 0.92));
  border-top: 1px solid var(--line);
  padding: 30px 24px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
}

/* ============================================================
   移动端
   ============================================================ */
@media (max-width: 760px) {
  .nav-links {
    display: none;
  }

  .card-grid,
  .doodle-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 80px 20px;
  }
}

/* ============================================================
   文章阅读视图（单页路由，沉浸暗色 + 毛玻璃）
   ============================================================ */
.reader {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: hidden;
  background: rgba(4, 4, 7, 0.78);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.reader-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 72px 24px 96px;
}

.reader-content {
  max-width: 720px;
  margin: 0 auto;
  transition: opacity 0.35s ease;
}

.reader-head {
  margin-bottom: 40px;
}

.reader-title {
  margin-top: 14px;
  font-size: clamp(26px, 4.5vw, 38px);
  font-weight: 800;
  line-height: 1.25;
  background: linear-gradient(90deg, #5ec8ff, #ffffff, #ffc08a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.reader-md {
  font-size: 17px;
  line-height: 1.9;
  color: #dfe2ea;
}

.reader-md h1,
.reader-md h2,
.reader-md h3 {
  color: #ffffff;
  margin: 1.6em 0 0.7em;
  line-height: 1.35;
}

.reader-md h1 {
  font-size: 26px;
}

.reader-md h2 {
  font-size: 22px;
}

.reader-md h3 {
  font-size: 18px;
}

.reader-md p {
  margin: 1em 0;
}

.reader-md a {
  color: #6fc2ff;
}

.reader-md ul,
.reader-md ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.reader-md li {
  margin: 0.4em 0;
}

.reader-md blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid #ff9a3c;
  color: #c7ccd8;
}

.reader-md code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
}

.reader-md pre {
  margin: 1.4em 0;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
}

.reader-md pre code {
  background: none;
  padding: 0;
  color: #8fe0b8;
}

.reader-md img {
  max-width: 100%;
  border-radius: 12px;
  margin: 1.4em 0;
}

.reader-md hr {
  margin: 2em 0;
  border: none;
  border-top: 1px solid var(--line);
}

.reader-back {
  position: fixed;
  top: 22px;
  left: 24px;
  z-index: 210;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  background: rgba(12, 13, 18, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: box-shadow 0.3s, background 0.3s, transform 0.3s;
}

.reader-back:focus-visible {
  outline: 2px solid rgba(79, 183, 255, 0.9);
  outline-offset: 3px;
}

.reader-back-icon {
  width: 22px;
  height: 22px;
}

.reader-back-icon path {
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(79, 183, 255, 0.55));
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reader-back:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 20px rgba(79, 183, 255, 0.4);
}

.reader-back:hover .reader-back-icon path {
  transform: translateX(-2px);
}

.reader-back:active {
  transform: scale(0.94);
}

/* 阅读滚动条 */
.reader-scroll::-webkit-scrollbar {
  width: 10px;
}

.reader-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}

/* ============================================================
   回到顶部
   ============================================================ */
.totop {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 150;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(12, 13, 18, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  color: #fff;
  transition: opacity 0.3s, box-shadow 0.3s, transform 0.3s;
  /* 让隐藏时平滑消失 */
}

.totop-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.totop-track,
.totop-progress {
  fill: none;
  stroke-width: 3;
}

.totop-track {
  stroke: rgba(255, 255, 255, 0.12);
}

.totop-progress {
  stroke: url(#totopGrad);
  stroke-linecap: round;
  /* dashoffset 由 JS 按滚动进度更新 */
}

.totop-arrow {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.totop-arrow svg {
  width: 20px;
  height: 20px;
}

.totop-arrow svg path {
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(79, 183, 255, 0.6));
}

.totop:hover {
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 24px rgba(79, 183, 255, 0.4);
}

.totop:hover .totop-arrow {
  transform: translateY(-3px);
  text-shadow: 0 0 8px #4fb7ff;
}

.totop[hidden] {
  opacity: 0;
  pointer-events: none;
}

/* 无障碍：减少动态时静默直显 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* 移动端：阅读与区块适配 */
@media (max-width: 760px) {
  .project-grid {
    grid-template-columns: 1fr;
  }

  .reader-scroll {
    padding: 64px 16px 80px;
  }

  .reader-back {
    top: 14px;
    left: 16px;
  }

  .totop {
    right: 16px;
    bottom: 16px;
  }
}