/* ========================================
   Personal Homepage — Zhuoqi Fu (Allen)
   ======================================== */

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

:root {
  --color-bg:        #0a0f0c;
  --color-surface:   rgba(255,255,255,0.06);
  --color-text:      #e8ece9;
  --color-muted:     #9daba2;
  --color-accent:    #00704A;
  --color-accent-hi: #00995f;
  --color-accent2:   #1db954;
  --color-border:    rgba(255,255,255,0.08);
  --color-github:    #24292f;
  --color-linkedin:  #0a66c2;
  --radius:          16px;
  --radius-full:     9999px;
  --shadow-sm:       0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:       0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow:     0 0 30px rgba(0,112,74,0.3);
  --font-sans:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

/* --- Animated Background --- */
body {
  font-family: var(--font-sans);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--color-bg);
  overflow-x: hidden;
}

/* Floating gradient orbs */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}

body::before {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--color-accent), transparent 70%);
  top: -10%;
  left: -15%;
  animation: floatOrb1 18s ease-in-out infinite;
}

body::after {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--color-accent2), transparent 70%);
  bottom: -10%;
  right: -12%;
  animation: floatOrb2 22s ease-in-out infinite;
}

@keyframes floatOrb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(60px, 40px) scale(1.15); }
  50%      { transform: translate(20px, -30px) scale(0.9); }
  75%      { transform: translate(-30px, -20px) scale(1.1); }
}

@keyframes floatOrb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(-50px, -30px) scale(1.2); }
  66%      { transform: translate(30px, 20px) scale(0.85); }
}

/* --- Container --- */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

/* --- Hero --- */
.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

/* Entry animation for hero */
.hero.animate-on-load {
  animation: fadeInUp 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* --- Avatar --- */
.avatar-wrapper {
  display: inline-block;
  border-radius: var(--radius-full);
  padding: 4px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent2));
  animation: avatarGlow 3s ease-in-out infinite, avatarFloat 5s ease-in-out infinite;
  transition: transform 0.35s ease;
  box-shadow: var(--shadow-glow);
}

.avatar-wrapper:hover {
  transform: scale(1.06);
  box-shadow: 0 0 50px rgba(0,112,74,0.5);
}

.avatar {
  display: block;
  width: 140px;
  height: 140px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 4px solid rgba(255,255,255,0.1);
}

@keyframes avatarGlow {
  0%, 100% { box-shadow: 0 0 25px rgba(0,112,74,0.3); }
  50%      { box-shadow: 0 0 45px rgba(0,112,74,0.5), 0 0 80px rgba(29,185,84,0.15); }
}

@keyframes avatarFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* --- Name --- */
.name {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 1rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 30%, #9daba2 70%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.name-nick {
  font-weight: 400;
  -webkit-text-fill-color: var(--color-muted);
}

/* --- Tagline / Typing --- */
.tagline {
  font-size: 1.1rem;
  margin-top: 0.35rem;
  color: var(--color-muted);
  min-height: 1.7rem;
}

.cursor {
  display: inline-block;
  color: var(--color-accent2);
  font-weight: 300;
  animation: blink 0.8s step-end infinite;
}

.cursor.done {
  animation: blink 1.4s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* --- Social Links --- */
.links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.6rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  color: #fff;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Shimmer effect */
.link-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255,255,255,0.12) 45%,
    rgba(255,255,255,0.18) 50%,
    rgba(255,255,255,0.12) 55%,
    transparent 60%
  );
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.link-btn:hover::after {
  transform: translateX(100%);
}

.link-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.link-btn.github {
  background: var(--color-github);
}

.link-btn.github:hover {
  background: #1b1f23;
}

.link-btn.linkedin {
  background: var(--color-linkedin);
}

.link-btn.linkedin:hover {
  background: #004182;
}

.link-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* --- Experience / Glassmorphism --- */
.experience {
  background: var(--color-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.4s ease;
}

.experience:hover {
  box-shadow: var(--shadow-md);
}

.experience h2 {
  font-size: 1.35rem;
  font-weight: 650;
  margin-bottom: 1.5rem;
  color: #fff;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 1.75rem;
}

/* Timeline vertical line — draws on scroll */
.timeline::before {
  content: "";
  position: absolute;
  left: 0.375rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--color-accent),
    var(--color-accent2)
  );
  transform-origin: top;
  animation: drawLine 1.2s ease-out both;
  animation-timeline: view();
  animation-range: entry 0% entry 100%;
}

/* Fallback for browsers without scroll-driven animations */
@supports not (animation-timeline: view()) {
  .timeline::before {
    animation: drawLineFallback 1.2s ease-out both;
  }
}

@keyframes drawLine {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

@keyframes drawLineFallback {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateX(0);
}

.timeline-dot {
  position: absolute;
  left: -1.75rem;
  top: 0.45rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 0 12px rgba(0,112,74,0.5);
  transition: box-shadow 0.4s ease;
}

.timeline-item.visible .timeline-dot {
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(0,112,74,0.5); }
  50%      { box-shadow: 0 0 20px rgba(29,185,84,0.6), 0 0 35px rgba(0,112,74,0.3); }
}

.timeline-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}

.timeline-meta {
  display: block;
  font-size: 0.85rem;
  color: var(--color-accent2);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.timeline-content p {
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* --- Footer --- */
.footer {
  text-align: center;
  margin-top: 2rem;
  color: var(--color-muted);
  font-size: 0.85rem;
  opacity: 0.7;
}

/* --- Keyframes --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsive --- */
@media (max-width: 480px) {
  body {
    padding: 1.5rem 1rem;
  }

  .name {
    font-size: 1.6rem;
  }

  .experience {
    padding: 1.25rem;
  }

  .links {
    flex-direction: column;
    align-items: stretch;
  }

  .link-btn {
    justify-content: center;
  }

  body::before {
    width: 300px;
    height: 300px;
  }

  body::after {
    width: 250px;
    height: 250px;
  }
}
