:root {
  --bg: #fafafa;
  --bg-surface: #ffffff;
  --fg: #171717;
  --fg-muted: #737373;
  --fg-subtle: #a3a3a3;
  --border: #e5e5e5;
  --border-hover: #d4d4d4;
  --tag-bg: #f5f5f5;
  --tag-fg: #525252;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* ---- Reset ---- */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--fg);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

svg {
  display: block;
}

/* ---- Layout ---- */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 64px 0;
}

/* ---- Navigation ---- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(250, 250, 250, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

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

.nav-logo {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.nav-toggle {
  display: block;
  padding: 4px;
}

.nav-links {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: rgba(250, 250, 250, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  padding: 16px 24px;
  gap: 16px;
}

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

.nav-link {
  font-size: 14px;
  color: var(--fg-muted);
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--fg);
}

/* ---- Hero / About ---- */

.hero {
  padding-top: 140px;
  padding-bottom: 64px;
}

.avatar {
  border-radius: 50%;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.tagline {
  font-size: 18px;
  color: var(--fg-muted);
  margin-top: 8px;
}

.bio {
  margin-top: 24px;
  color: var(--fg-muted);
}

.social-links {
  display: flex;
  gap: 24px;
  margin-top: 32px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--fg-muted);
  transition: color 0.2s ease;
}

.social-link:hover {
  color: var(--fg);
}

.social-link svg {
  flex-shrink: 0;
}

/* ---- Section headings ---- */

h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 32px;
}

/* ---- Projects ---- */

#projects-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-card {
  display: block;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s ease;
}

.project-card:hover {
  border-color: var(--border-hover);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.card-header h3 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.card-header svg {
  flex-shrink: 0;
  color: var(--fg-subtle);
  margin-top: 3px;
  transition: color 0.2s ease;
}

.project-card:hover .card-header svg {
  color: var(--fg-muted);
}

.card-description {
  margin-top: 8px;
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-fg);
  border-radius: 4px;
}

/* ---- Skeleton loading ---- */

.skeleton-card {
  height: 120px;
  background: var(--tag-bg);
  border-radius: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* ---- Fallback ---- */

.fallback-link {
  display: inline-block;
  font-size: 14px;
  color: var(--fg-muted);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.fallback-link:hover {
  color: var(--fg);
  border-color: var(--fg);
}

/* ---- Contact ---- */

.contact-text {
  color: var(--fg-muted);
  margin-bottom: 32px;
  max-width: 480px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--fg-muted);
  width: fit-content;
  transition: color 0.2s ease;
}

.contact-link span {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.3s ease, text-underline-offset 0.3s ease;
}

.contact-link:hover {
  color: var(--fg);
}

.contact-link:hover span {
  text-decoration-color: var(--fg);
  text-underline-offset: 2px;
}

.contact-link svg {
  flex-shrink: 0;
}

/* ---- Footer ---- */

.footer {
  padding: 24px 0;
  text-align: center;
}

.footer p {
  font-size: 14px;
  color: var(--fg-subtle);
}

/* ---- Animations ---- */

.animate-item {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp 0.6s ease forwards;
}

.animate-item:nth-child(1) { animation-delay: 0.1s; }
.animate-item:nth-child(2) { animation-delay: 0.2s; }
.animate-item:nth-child(3) { animation-delay: 0.3s; }
.animate-item:nth-child(4) { animation-delay: 0.4s; }
.animate-item:nth-child(5) { animation-delay: 0.5s; }

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

.animate-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Responsive: Tablet ---- */

@media (min-width: 640px) {
  .nav-toggle {
    display: none;
  }

  .nav-links {
    display: flex;
    position: static;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    flex-direction: row;
    padding: 0;
    gap: 32px;
  }

  .nav-link {
    position: relative;
  }

  .nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--fg);
    transition: width 0.3s ease;
  }

  .nav-link:hover::after {
    width: 100%;
  }

  .hero h1 {
    font-size: 42px;
  }
}

/* ---- Responsive: Desktop ---- */

@media (min-width: 1024px) {
  .hero h1 {
    font-size: 48px;
  }

  .section {
    padding: 96px 0;
  }

  .hero {
    padding-top: 180px;
    padding-bottom: 96px;
  }

  .card-header h3 {
    font-size: 20px;
  }
}
