/* =========================================
   SUNXIAOHANG · Apple-style Personal Site
   ========================================= */

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

:root {
  --bg: #000000;
  --bg-1: #0a0a0a;
  --bg-2: #111111;
  --surface: rgba(255,255,255,0.05);
  --surface-hover: rgba(255,255,255,0.09);
  --border: rgba(255,255,255,0.1);
  --border-hover: rgba(255,255,255,0.2);
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #6e6e73;
  --accent: #2997ff;
  --accent-2: #bf5af2;
  --accent-3: #30d158;
  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 52px;
  --transition: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display',
               'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* ── Selection ── */
::selection { background: rgba(41,151,255,0.35); color: #fff; }

/* =========================================
   NAV
   ========================================= */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 1000;
  transition: background var(--transition), backdrop-filter var(--transition),
              border-color var(--transition);
}

#navbar.scrolled {
  background: rgba(0,0,0,0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.nav-logo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: linear-gradient(90deg, #fff 0%, rgba(255,255,255,0.6) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity 0.2s;
}
.nav-logo:hover { opacity: 0.75; }

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

.nav-links a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: var(--transition);
}

/* =========================================
   BUTTONS
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 980px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 0.25s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: #0a84ff;
  transform: scale(1.04);
  box-shadow: 0 8px 24px rgba(41,151,255,0.4);
}

.btn-ghost {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.16);
  border-color: var(--border-hover);
  transform: scale(1.04);
}

.btn-sm {
  padding: 9px 20px;
  font-size: 0.8rem;
}

/* =========================================
   GLASS CARD
   ========================================= */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background var(--transition), border-color var(--transition),
              transform var(--transition), box-shadow var(--transition);
}
.glass-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

/* =========================================
   HERO
   ========================================= */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 24px;
}

/* animated gradient orbs */
.hero-bg { position: absolute; inset: 0; pointer-events: none; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  animation: orbFloat 12s ease-in-out infinite alternate;
}
.orb-1 {
  width: 600px; height: 600px;
  top: -200px; left: -150px;
  background: radial-gradient(circle, #2997ff 0%, transparent 70%);
  animation-duration: 14s;
}
.orb-2 {
  width: 500px; height: 500px;
  top: 100px; right: -100px;
  background: radial-gradient(circle, #bf5af2 0%, transparent 70%);
  animation-duration: 10s;
  animation-delay: -4s;
}
.orb-3 {
  width: 400px; height: 400px;
  bottom: -100px; left: 30%;
  background: radial-gradient(circle, #30d158 0%, transparent 70%);
  animation-duration: 16s;
  animation-delay: -8s;
}

@keyframes orbFloat {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -40px) scale(1.05); }
  66%  { transform: translate(-20px, 20px) scale(0.97); }
  100% { transform: translate(40px, -20px) scale(1.03); }
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 780px;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 980px;
  background: rgba(41,151,255,0.15);
  border: 1px solid rgba(41,151,255,0.35);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 28px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.8s 0.2s forwards;
}

.hero-title {
  font-size: clamp(3.2rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 24px;
}

.hero-title .line {
  display: block;
  opacity: 0;
  transform: translateY(30px);
}
.hero-title .line:nth-child(1) { animation: fadeUp 0.8s 0.4s forwards; }
.hero-title .line:nth-child(2) { animation: fadeUp 0.8s 0.6s forwards; }

.gradient-text {
  background: linear-gradient(90deg, #2997ff 0%, #bf5af2 50%, #ff6584 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 100%;
  animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 36px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.8s 0.8s forwards;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.8s 1s forwards;
}

.hero-scroll-hint {
  margin-top: 64px;
  display: flex;
  justify-content: center;
  opacity: 0;
  animation: fadeUp 0.8s 1.4s forwards;
}
.hero-scroll-hint span {
  display: block;
  width: 2px;
  height: 48px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.5), transparent);
  border-radius: 1px;
  animation: scrollLine 2s ease-in-out infinite;
}
@keyframes scrollLine {
  0%   { transform: scaleY(0); transform-origin: top; }
  50%  { transform: scaleY(1); transform-origin: top; }
  50.001% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   SECTIONS COMMON
   ========================================= */
section { padding: 120px 24px; }

.container {
  max-width: 1080px;
  margin: 0 auto;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.section-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin-bottom: 56px;
  color: var(--text);
}

/* =========================================
   ABOUT
   ========================================= */
#about { background: var(--bg-1); }

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.about-card {
  padding: 32px 28px;
}

.about-icon {
  font-size: 2.2rem;
  margin-bottom: 16px;
  display: block;
}

.about-card h3 {
  font-size: 1.05rem;
  font-weight: 650;
  margin-bottom: 10px;
  color: var(--text);
}

.about-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.about-card strong { color: var(--text); }

/* =========================================
   WORKS
   ========================================= */
#works { background: var(--bg); }

.works-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.work-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.work-card.featured {
  grid-column: span 2;
  flex-direction: row;
}

.work-thumb {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.work-card:not(.featured) .work-thumb {
  height: 180px;
  width: 100%;
}

.work-card.featured .work-thumb {
  width: 42%;
  min-height: 240px;
}

.work-thumb-icon {
  font-size: 3.2rem;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.4));
  transition: transform 0.4s ease;
}
.work-card:hover .work-thumb-icon { transform: scale(1.15) rotate(-5deg); }

.work-info { padding: 28px; flex: 1; }

.work-tag {
  display: inline-block;
  padding: 3px 12px;
  background: rgba(41,151,255,0.12);
  color: var(--accent);
  border-radius: 980px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.work-info h3 {
  font-size: 1.15rem;
  font-weight: 650;
  margin-bottom: 10px;
}

.work-info p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.work-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s;
}
.work-link:hover { gap: 8px; }

/* =========================================
   GAMES
   ========================================= */
#games { background: var(--bg-1); }

.games-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.game-card { overflow: hidden; }

.game-preview {
  height: 180px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-preview-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.pixel-art {
  font-size: 3.5rem;
  z-index: 1;
  animation: pixelBob 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255,255,255,0.3));
}
@keyframes pixelBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.game-particles { position: absolute; inset: 0; overflow: hidden; }
.game-particles span {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  animation: particle 4s linear infinite;
}
.game-particles span:nth-child(1) { left:15%; animation-delay: 0s; }
.game-particles span:nth-child(2) { left:35%; animation-delay: 1s; }
.game-particles span:nth-child(3) { left:65%; animation-delay: 2s; }
.game-particles span:nth-child(4) { left:80%; animation-delay: 0.5s; }
@keyframes particle {
  0%   { top: 100%; opacity: 0; transform: scale(0); }
  10%  { opacity: 1; transform: scale(1); }
  90%  { opacity: 1; }
  100% { top: -10%; opacity: 0; transform: scale(0.5); }
}

.game-info { padding: 24px; }
.game-info h3 { font-size: 1.1rem; font-weight: 650; margin-bottom: 8px; }
.game-info p { font-size: 0.86rem; color: var(--text-secondary); margin-bottom: 14px; line-height: 1.7; }

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 980px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* =========================================
   TOOLS
   ========================================= */
#tools { background: var(--bg); }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  cursor: pointer;
}

.tool-icon {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.tool-body { flex: 1; }
.tool-body h3 { font-size: 0.95rem; font-weight: 650; margin-bottom: 4px; }
.tool-body p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }

.tool-arrow {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--text-tertiary);
  transition: transform 0.25s, color 0.25s;
}
.tool-card:hover .tool-arrow {
  transform: translateX(5px);
  color: var(--accent);
}

/* =========================================
   CONTACT
   ========================================= */
#contact { background: var(--bg-1); text-align: center; }

.contact-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-top: -32px;
  margin-bottom: 52px;
}

.contact-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 720px;
  margin: 0 auto;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 28px;
  min-width: 200px;
  transition: all var(--transition);
}

.contact-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-icon.bilibili {
  background: linear-gradient(135deg, #c63760, #bd4162);
  color: #fff;
}
.contact-icon.douyin {
  background: linear-gradient(135deg, #000000, #000000);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
}
.contact-icon.email {
  background: linear-gradient(135deg, #18446d, #15416d);
  color: #fff;
}

.contact-info { text-align: left; }
.contact-platform {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}
.contact-handle {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* =========================================
   FOOTER
   ========================================= */
footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 40px 24px;
}
.footer-inner { text-align: center; }

.footer-logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: linear-gradient(90deg, #fff 0%, rgba(255,255,255,0.4) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.footer-tagline {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-style: italic;
}

/* =========================================
   SCROLL REVEAL
   ========================================= */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.25,0.46,0.45,0.94),
              transform 0.8s cubic-bezier(0.25,0.46,0.45,0.94);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.25,0.46,0.45,0.94),
              transform 0.7s cubic-bezier(0.25,0.46,0.45,0.94);
}
.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0.05s; opacity:1; transform:none; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.15s; opacity:1; transform:none; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.25s; opacity:1; transform:none; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.35s; opacity:1; transform:none; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.45s; opacity:1; transform:none; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.55s; opacity:1; transform:none; }

/* =========================================
   MOBILE NAV OPEN
   ========================================= */
.nav-open .nav-links {
  display: flex !important;
  flex-direction: column;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(20px);
  padding: 24px;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }

  section { padding: 80px 20px; }
  .section-title { margin-bottom: 36px; }

  .works-grid { grid-template-columns: 1fr; }
  .work-card.featured { flex-direction: column; grid-column: span 1; }
  .work-card.featured .work-thumb { width: 100%; min-height: 200px; }

  .contact-links { flex-direction: column; align-items: center; }
  .contact-card { width: 100%; max-width: 360px; }

  .about-grid { grid-template-columns: 1fr 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .about-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 2.8rem; }
  .hero-actions { flex-direction: column; align-items: center; }
}
