/* ================================================
   Variables
   ================================================ */
:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --text-primary: #1A1A1E;
  --text-secondary: #6B7080;
  --text-muted: #ABABBB;
  --border: #E8EAED;
  --accent: #4477EE;
  --accent-hover: #3363DD;
  --accent-light: #EEF2FF;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --nav-height: 64px;
  --max-width: 1100px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --transition: 0.22s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
h1, h2, h3 { letter-spacing: -0.025em; line-height: 1.25; }

/* ================================================
   Layout
   ================================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 72px 0;
}

.section-header {
  margin-bottom: 48px;
}

.section-title {
  font-size: 1.65rem;
  font-weight: 750;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* ================================================
   Navigation
   ================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.nav-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-brand .accent { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
}

.nav-links a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
  position: relative;
  padding-bottom: 2px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.22s ease;
}

.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after { width: 100%; }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ================================================
   Buttons
   ================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(68, 119, 238, 0.35);
}

.btn-secondary {
  border: 1.5px solid var(--border);
  color: var(--text-primary);
  background: var(--surface);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-outline {
  border: 1.5px solid var(--accent);
  color: var(--accent);
  background: transparent;
  width: 100%;
  justify-content: center;
}

.btn-outline:hover {
  background: var(--accent-light);
}

/* ================================================
   Tags
   ================================================ */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
  letter-spacing: 0.01em;
}

.tag-gray {
  background: #F0F0F3;
  color: var(--text-secondary);
}

/* ================================================
   Project Cards (shared)
   ================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #F0F4FF;
}

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title {
  font-size: 1rem;
  font-weight: 650;
  color: var(--text-primary);
}

.card-desc {
  font-size: 0.855rem;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.card-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--transition);
}

.card-link:hover { gap: 8px; }

/* ================================================
   Hero (index.html)
   ================================================ */
.hero {
  padding: 88px 0 72px;
  text-align: center;
  background: linear-gradient(180deg, #F7F8FA 0%, #FFFFFF 100%);
}

.hero-avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  margin: 0 auto 28px;
  object-fit: cover;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
}

.hero-name {
  font-size: 2.6rem;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.hero-tagline {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 460px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ================================================
   Featured Projects (index.html)
   ================================================ */
.featured-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-cta {
  margin-top: 40px;
  text-align: center;
}

/* ================================================
   Page Header (projects.html)
   ================================================ */
.page-hero {
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.page-hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.page-hero-sub {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* ================================================
   Project Detail (project-detail.html)
   ================================================ */
.detail-wrapper {
  padding: 48px 0 80px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--border); }

.detail-hero-img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 40px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  align-items: start;
}

.detail-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.detail-tags {
  margin-bottom: 24px;
}

.detail-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.85;
}

.detail-desc p + p { margin-top: 16px; }

.detail-desc h3 {
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text-primary);
  margin: 28px 0 10px;
}

.detail-desc ul {
  list-style: disc;
  padding-left: 20px;
  color: var(--text-secondary);
}

.detail-desc li { margin-bottom: 6px; }

/* Sidebar */
.detail-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 24px);
}

.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.sidebar-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.sidebar-value {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* Screenshots */
.screenshots-section {
  margin-top: 56px;
}

.screenshots-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.screenshot {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.screenshot:hover {
  box-shadow: var(--shadow-md);
  transform: scale(1.01);
}

/* ================================================
   About (about.html)
   ================================================ */
.about-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: center;
  padding: 72px 0 56px;
}

.about-avatar {
  width: 144px;
  height: 144px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
}

.about-name {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.about-role {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
}

.about-bio {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 560px;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 20px 18px;
  transition: border-color var(--transition), transform var(--transition);
}

.skill-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.skill-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.skill-name {
  font-size: 0.9rem;
  font-weight: 650;
  margin-bottom: 4px;
}

.skill-level {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), transform var(--transition);
}

.contact-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.contact-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.contact-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.contact-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ================================================
   Footer
   ================================================ */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 36px 0;
  text-align: center;
}

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

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

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--accent); }

/* ================================================
   Scroll Fade-in Animation
   ================================================ */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================
   Responsive
   ================================================ */

/* Tablet */
@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-sidebar {
    position: static;
  }

  .sidebar-card {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0 24px;
    align-items: start;
  }

  .about-hero {
    grid-template-columns: auto 1fr;
    gap: 32px;
  }

  .about-avatar {
    width: 110px;
    height: 110px;
  }
}

/* Mobile nav + large */
@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: calc(var(--nav-height) - 1px);
    left: -24px;
    right: -24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open { display: flex; }

  .nav-links li a {
    display: block;
    padding: 15px 24px;
    font-size: 0.95rem;
  }

  .nav-links a::after { display: none; }

  .hero { padding: 56px 0 48px; }
  .hero-name { font-size: 2rem; }
  .hero-tagline { font-size: 0.95rem; }

  .page-hero { padding: 40px 0 32px; }
  .page-hero-title { font-size: 1.7rem; }

  .section { padding: 52px 0; }
  .section-header { margin-bottom: 32px; }

  .about-hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 48px 0 40px;
    justify-items: center;
  }

  .about-bio { margin: 0 auto; }

  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .hero-name { font-size: 1.8rem; }

  .detail-title { font-size: 1.5rem; }

  .screenshots-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
