/* ============================================================
 * 程曦 | Personal Portfolio - Stylesheet
 * 风格：深色专业科技风（Dark Pro Tech）
 * 配色：深蓝背景 + 蓝青主色 + 冷灰文字
 * ============================================================ */

/* ---------- 0. Tokens & Easing ---------- */
:root {
  /* Color tokens */
  --bg-base:        #0A0E17;
  --bg-alt:         #0D1321;
  --surface:        #111827;
  --surface-hover:  #161F33;
  --border:         rgba(255, 255, 255, 0.08);
  --border-strong:  rgba(255, 255, 255, 0.16);

  --primary:        #4F9CF7;   /* 主蓝 */
  --primary-hover:  #3a87e0;
  --primary-soft:   rgba(79, 156, 247, 0.12);
  --accent:         #20C997;   /* 青绿状态色 */
  --accent-2:       #764ba2;   /* 紫色（渐变用）*/

  --text-primary:   #E6EDF3;
  --text-secondary: #A8B2C1;
  --text-tertiary:  #8892A0;
  --text-muted:     #555e6e;

  /* Easing */
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-standard:  cubic-bezier(0.2, 0, 0, 1);

  /* Radius */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-2xl: 24px;

  /* Typography */
  --font-sans:   "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:   "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;
}

/* ---------- 1. Base & Reset ---------- */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
}

::selection {
  background: var(--primary);
  color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: rgba(79, 156, 247, 0.25);
  border-radius: 10px;
  border: 2px solid var(--bg-base);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 156, 247, 0.5);
}

/* Font mapping: font-sans / font-mono in Tailwind style utility */
.font-sans   { font-family: var(--font-sans); }
.font-mono   { font-family: var(--font-mono); }

/* ---------- 2. Grid Background Utility ---------- */
.bg-grid {
  background-image:
    linear-gradient(to right, rgba(79,156,247,0.15) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(79,156,247,0.15) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 40%, transparent 80%);
}

/* ---------- 3. Nav Links ---------- */
.nav-link {
  position: relative;
  color: var(--text-secondary);
  transition: color 0.2s var(--ease-standard);
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 0; height: 2px;
  background: var(--primary);
  transition: width 0.3s var(--ease-out-quart);
}
.nav-link:hover {
  color: var(--text-primary);
}
.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.mobile-nav-link {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
  display: block;
}
.mobile-nav-link:hover { color: var(--primary); }

/* ---------- 4. Hero Animation ---------- */
.hero-line {
  opacity: 0;
  transform: translateY(24px);
  animation: heroRise 0.9s var(--ease-out-expo) forwards;
}
.hero-line:nth-child(1) { animation-delay: 0.15s; }
.hero-line:nth-child(2) { animation-delay: 0.30s; }
.hero-line:nth-child(3) { animation-delay: 0.45s; }
.hero-line:nth-child(4) { animation-delay: 0.60s; }
.hero-line:nth-child(5) { animation-delay: 0.75s; }

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

/* ---------- 5. Scroll Reveal ---------- */
.reveal, .reveal-left, .reveal-right {
  opacity: 0;
  transition:
    opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
}
.reveal       { transform: translateY(30px); }
.reveal-left  { transform: translateX(-40px); }
.reveal-right { transform: translateX(40px); }

.reveal.active,
.reveal-left.active,
.reveal-right.active {
  opacity: 1;
  transform: translate(0, 0);
}

/* Stagger children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.6s var(--ease-out-expo),
    transform 0.6s var(--ease-out-expo);
}
.stagger-children.active > *:nth-child(1) { transition-delay: 0.00s; opacity:1; transform: translateY(0); }
.stagger-children.active > *:nth-child(2) { transition-delay: 0.08s; opacity:1; transform: translateY(0); }
.stagger-children.active > *:nth-child(3) { transition-delay: 0.16s; opacity:1; transform: translateY(0); }
.stagger-children.active > *:nth-child(4) { transition-delay: 0.24s; opacity:1; transform: translateY(0); }
.stagger-children.active > *:nth-child(5) { transition-delay: 0.32s; opacity:1; transform: translateY(0); }
.stagger-children.active > *:nth-child(6) { transition-delay: 0.40s; opacity:1; transform: translateY(0); }
.stagger-children.active > *:nth-child(7) { transition-delay: 0.48s; opacity:1; transform: translateY(0); }
.stagger-children.active > *:nth-child(8) { transition-delay: 0.56s; opacity:1; transform: translateY(0); }
.stagger-children.active > *:nth-child(9) { transition-delay: 0.64s; opacity:1; transform: translateY(0); }

/* ---------- 6. About: Info Cards ---------- */
.info-card {
  padding: 20px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  transition: border-color 0.25s var(--ease-standard), transform 0.25s var(--ease-standard);
}
.info-card:hover {
  border-color: rgba(79, 156, 247, 0.4);
  transform: translateY(-2px);
}
.info-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--r-md);
  flex: none;
}

.tech-tag {
  list-style: none;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ---------- 7. Skill Cards ---------- */
.skill-card {
  padding: 28px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  position: relative;
  overflow: hidden;
  transition:
    transform 0.35s var(--ease-out-quart),
    border-color 0.35s var(--ease-standard),
    box-shadow 0.35s var(--ease-standard);
}
.skill-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  transition: opacity 0.35s;
}
.skill-card:hover {
  transform: translateY(-4px);
  border-color: rgba(79, 156, 247, 0.35);
  box-shadow: 0 20px 40px -20px rgba(79, 156, 247, 0.25);
}
.skill-card:hover::before { opacity: 1; }

.skill-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.skill-icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--r-md);
  font-size: 20px;
  transition: all 0.3s;
}
.skill-card:hover .skill-icon {
  background: var(--primary);
  color: #fff;
  transform: scale(1.05) rotate(-2deg);
}

.skill-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ---------- 8. Project Cards ---------- */
.project-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.35s var(--ease-out-quart),
    border-color 0.35s,
    box-shadow 0.35s;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(79, 156, 247, 0.4);
  box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.6);
}
.project-image-wrap {
  position: relative;
  height: 208px;
  overflow: hidden;
  background: #0a0e17;
}
.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out-expo);
}
.project-card:hover .project-image {
  transform: scale(1.06);
}
.project-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,14,23,0) 40%, rgba(10,14,23,0.8) 100%);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 16px 18px;
  opacity: 0;
  transition: opacity 0.35s;
}
.project-card:hover .project-overlay { opacity: 1; }

.project-tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(79, 156, 247, 0.08);
  color: var(--primary);
  border: 1px solid rgba(79, 156, 247, 0.18);
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ---------- 9. Timeline ---------- */
.timeline-item {
  position: relative;
}
.timeline-dot-wrap {
  position: relative;
  width: 16px;
}
/* desktop timeline dot (aligned with timeline line) */
@media (min-width: 768px) {
  .timeline-dot-wrap { width: 116px; }
}
.timeline-dot {
  position: absolute;
  top: 8px;
  left: 0;
  width: 14px;
  height: 14px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(79, 156, 247, 0.18), 0 0 20px rgba(79, 156, 247, 0.4);
}
@media (min-width: 768px) {
  .timeline-dot {
    left: auto;
    right: 0;
    transform: translateX(50%);
    top: 10px;
    width: 16px;
    height: 16px;
  }
}
.timeline-line {
  left: 7px !important;
}

/* ---------- 10. Contact Cards ---------- */
.contact-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition:
    transform 0.3s var(--ease-out-quart),
    border-color 0.3s,
    background 0.3s;
}
a.contact-card:hover {
  transform: translateY(-3px);
  border-color: rgba(79, 156, 247, 0.4);
  background: var(--surface-hover);
}
.contact-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--r-md);
  flex: none;
  font-size: 18px;
}

/* ---------- 11. Buttons (override / ensure) ---------- */
.btn-primary,
.btn-secondary {
  font-family: var(--font-sans);
  text-decoration: none;
}

/* ---------- 12. Responsive polish ---------- */
@media (max-width: 640px) {
  .section-header h2 { font-size: 1.4rem; }
}
