/* ================================================================
   CSS for tangzixuan.cc
   ================================================================ */

/* ── CSS 变量 ─────────────────────────────────────────────────── */
:root {
  /* 颜色 */
  --bg: #0f0c29;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-h: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.1);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-inv: #1e293b;

  /* 品牌渐变 */
  --grad-hero: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  --grad-blog: linear-gradient(135deg, #6366f1, #a78bfa);
  --grad-core: linear-gradient(135deg, #0ea5e9, #38bdf8);
  --grad-study: linear-gradient(135deg, #1e3a5f, #4a90d9);
  --grad-tools: linear-gradient(135deg, #10b981, #34d399);
  --grad-ai: linear-gradient(135deg, #f59e0b, #f97316);
  --grad-accent: linear-gradient(90deg, #a78bfa, #38bdf8, #34d399);

  /* 卡片辉光 */
  --glow-blog: rgba(167, 139, 250, 0.3);
  --glow-core: rgba(56, 189, 248, 0.3);
  --glow-study: rgba(74, 144, 217, 0.34);
  --glow-tools: rgba(52, 211, 153, 0.3);
  --glow-ai: rgba(249, 115, 22, 0.3);

  /* 字体 */
  --font:
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Inter", system-ui,
    sans-serif;
  --font-mono: "Fira Code", "Cascadia Code", "Consolas", monospace;

  /* 间距 / 圆角 / 阴影 */
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --transition: 0.3s ease;
  --transition-s: 0.15s ease;
}

/* 亮色主题 */
[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-h: rgba(255, 255, 255, 1);
  --border: rgba(0, 0, 0, 0.08);
  --text: #1e293b;
  --text-muted: #64748b;
  --grad-hero: linear-gradient(135deg, #e0e7ff 0%, #f0f9ff 50%, #ecfdf5 100%);
  --glow-blog: rgba(99, 102, 241, 0.2);
  --glow-core: rgba(14, 165, 233, 0.2);
  --glow-study: rgba(30, 58, 95, 0.18);
  --glow-tools: rgba(16, 185, 129, 0.2);
  --glow-ai: rgba(249, 115, 22, 0.2);
}

/* ── Reset ────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition:
    background var(--transition),
    color var(--transition);
}

a {
  color: inherit;
  text-decoration: none;
}
img,
svg {
  display: block;
}

/* ── 粒子画布 ──────────────────────────────────────────────────── */
#particles-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* ── 容器 ─────────────────────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── 导航栏 ───────────────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 200;
  transition:
    background var(--transition),
    box-shadow var(--transition),
    backdrop-filter var(--transition);
}

.site-nav.scrolled {
  background: rgba(15, 12, 41, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 1px 0 var(--border);
}

[data-theme="light"] .site-nav.scrolled {
  background: rgba(255, 255, 255, 0.8);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
  color: var(--text);
}

.nav-logo em {
  font-style: normal;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--grad-accent);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.7);
  animation: pulse-glow 2s ease-in-out infinite;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition:
    color var(--transition-s),
    background var(--transition-s);
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-card);
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-card);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition:
    background var(--transition-s),
    transform var(--transition-s);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-card-h);
  transform: rotate(20deg);
}

/* ── Hero ─────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  padding: calc(var(--nav-h) + 4rem) 5vw 4rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad-hero);
  z-index: 0;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-content {
  flex: 1;
  max-width: 560px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  backdrop-filter: blur(8px);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
  animation: pulse-dot 2s ease-in-out infinite;
}

.hero-title {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  color: #fff;
}

[data-theme="light"] .hero-title {
  color: var(--text);
}

.title-line {
  display: block;
}

.title-domain {
  display: inline-block;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 2.5rem;
}

.hero-desc em {
  font-style: normal;
  opacity: 0.65;
  font-size: 0.9em;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition:
    opacity var(--transition-s),
    transform var(--transition-s),
    box-shadow var(--transition-s);
}

.btn:hover {
  transform: translateY(-2px);
  opacity: 0.92;
}
.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 8px 28px rgba(167, 139, 250, 0.55);
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  background: var(--grad-accent);
  color: #fff;
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color var(--transition-s);
}

.btn-ghost:hover {
  color: var(--text);
}

/* ── 轨道动画 (Hero visual) ───────────────────────────────────── */
.hero-visual {
  position: relative;
  width: 320px;
  height: 320px;
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .hero {
    flex-direction: column;
    text-align: center;
    padding-bottom: 3rem;
  }
  .hero-content {
    max-width: 100%;
  }
  .hero-actions {
    justify-content: center;
  }
  .hero-visual {
    width: 240px;
    height: 240px;
  }
}

.orbit-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--border);
  inset: 0;
  margin: auto;
  animation: orbit-spin linear infinite;
}

.ring-1 {
  width: 130px;
  height: 130px;
  animation-duration: 8s;
  border-color: rgba(167, 139, 250, 0.3);
}
.ring-2 {
  width: 220px;
  height: 220px;
  animation-duration: 14s;
  animation-direction: reverse;
}
.ring-3 {
  width: 310px;
  height: 310px;
  animation-duration: 20s;
}

@media (max-width: 860px) {
  .ring-1 {
    width: 100px;
    height: 100px;
  }
  .ring-2 {
    width: 165px;
    height: 165px;
  }
  .ring-3 {
    width: 235px;
    height: 235px;
  }
}

.orbit-core {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  border: 1px solid rgba(167, 139, 250, 0.4);
}

.orbit-dot {
  position: absolute;
  inset: 0;
  margin: auto;
  --r: 110px;
  width: 42px;
  height: 42px;
  transform: rotate(var(--angle)) translateY(calc(-1 * var(--r)))
    rotate(calc(-1 * var(--angle)));
  z-index: 1;
}

@media (max-width: 860px) {
  .orbit-dot {
    --r: 82px;
  }
}

.dot-blog {
  animation-duration: 8s;
}
.dot-core {
  animation-duration: 8s;
}
.dot-study {
  animation-duration: 8s;
}
.dot-tools {
  animation-duration: 8s;
}
.dot-ai {
  animation-duration: 8s;
}

.orbit-dot::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
}

.dot-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}

/* ── Sections ────────────────────────────────────────────────── */
.sites {
  position: relative;
  z-index: 1;
  padding: 6rem 0;
}

.section-title {
  text-align: center;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.section-sub {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 3rem;
  font-size: 0.95rem;
}

/* ── 卡片网格 ─────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  overflow: hidden;
  cursor: pointer;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    border-color var(--transition);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card:hover {
  transform: translateY(-6px) scale(1.01);
  background: var(--bg-card-h);
}

.card--blog:hover {
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 20px 60px var(--glow-blog);
}
.card--core:hover {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 20px 60px var(--glow-core);
}
.card--study:hover {
  border-color: rgba(74, 144, 217, 0.45);
  box-shadow: 0 20px 60px var(--glow-study);
}
.card--tools:hover {
  border-color: rgba(52, 211, 153, 0.5);
  box-shadow: 0 20px 60px var(--glow-tools);
}
.card--ai:hover {
  border-color: rgba(249, 115, 22, 0.5);
  box-shadow: 0 20px 60px var(--glow-ai);
}

/* 辉光背景层 */
.card-glow {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  filter: blur(40px);
}

.card--blog .card-glow {
  background: var(--glow-blog);
}
.card--core .card-glow {
  background: var(--glow-core);
}
.card--study .card-glow {
  background: var(--glow-study);
}
.card--tools .card-glow {
  background: var(--glow-tools);
}
.card--ai .card-glow {
  background: var(--glow-ai);
}
.card:hover .card-glow {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition);
}

.card:hover .card-icon {
  transform: rotate(-4deg) scale(1.08);
}

.card-tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.card-body {
  flex: 1;
  margin-bottom: 1.25rem;
}

.card-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.card-url {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.card--blog .card-url {
  color: #a78bfa;
}
.card--core .card-url {
  color: #38bdf8;
}
.card--study .card-url {
  color: #60a5fa;
}
.card--tools .card-url {
  color: #34d399;
}
.card--ai .card-url {
  color: #fb923c;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.card-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.card-link {
  font-size: 0.875rem;
  font-weight: 600;
  transition: letter-spacing var(--transition);
}

.card--blog .card-link {
  color: #a78bfa;
}
.card--core .card-link {
  color: #38bdf8;
}
.card--study .card-link {
  color: #60a5fa;
}
.card--tools .card-link {
  color: #34d399;
}
.card--ai .card-link {
  color: #fb923c;
}
.card:hover .card-link {
  letter-spacing: 0.03em;
}

/* ── About ────────────────────────────────────────────────────── */
.about {
  position: relative;
  z-index: 1;
  padding: 4rem 0 6rem;
}

.about-inner {
  display: flex;
  gap: 4rem;
  align-items: center;
  flex-wrap: wrap;
}

.about-text {
  flex: 1;
  min-width: 260px;
}
.about-text h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 1rem;
}
.about-text p {
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 0.95rem;
}

.gradient-text {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.about-stats {
  display: flex;
  gap: 2rem;
  flex-shrink: 0;
}

.stat {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-num {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Install Banner ───────────────────────────────────────────── */
.install-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(30, 27, 75, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  animation: slide-up-in 0.4s ease;
}

[data-theme="light"] .install-banner {
  background: rgba(255, 255, 255, 0.95);
}

/* ── Offline Toast ────────────────────────────────────────────── */
.offline-toast {
  position: fixed;
  top: calc(var(--nav-h) + 0.75rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: #7f1d1d;
  color: #fca5a5;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.875rem;
  font-weight: 500;
  animation: slide-down-in 0.3s ease;
}

/* ── Footer ───────────────────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-copy,
.footer-cf {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-cf a {
  color: var(--text-muted);
  transition: color var(--transition-s);
}
.footer-cf a:hover {
  color: var(--text);
}

/* ── Animations ───────────────────────────────────────────────── */
.animate-fade-in {
  opacity: 0;
  animation: fade-in 0.8s ease forwards;
}
.animate-slide-up {
  opacity: 0;
  animation: slide-up 0.8s ease forwards;
}
.delay-1 {
  animation-delay: 0.15s;
}
.delay-2 {
  animation-delay: 0.3s;
}
.delay-3 {
  animation-delay: 0.45s;
}

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}
.animate-on-scroll.in-view {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fade-in {
  to {
    opacity: 1;
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-up-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slide-down-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes orbit-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    box-shadow: 0 0 4px #34d399;
  }
  50% {
    box-shadow:
      0 0 12px #34d399,
      0 0 20px rgba(52, 211, 153, 0.4);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 6px rgba(167, 139, 250, 0.6);
  }
  50% {
    box-shadow:
      0 0 14px rgba(167, 139, 250, 0.9),
      0 0 24px rgba(56, 189, 248, 0.4);
  }
}

/* ── 消减动画（用户偏好设置）─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── 移动端补充 ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-links {
    display: none;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .about-inner {
    flex-direction: column;
    gap: 2rem;
  }
  .about-stats {
    justify-content: center;
  }
  .footer-inner {
    justify-content: center;
    text-align: center;
  }
  .install-banner {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    transform: none;
    white-space: normal;
  }
}
