/* ============================================
   Design System & Variables
   ============================================ */
:root {
  /* Light theme */
  --bg: #f7f8fa;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --text: #1a1d24;
  --text-secondary: #6b7385;
  --text-tertiary: #919bab;
  --link: #1a1d24;
  --border: #e6e9ef;
  --accent: #6fcaff;
  --accent-soft: #e0f4ff;
  --accent-glow: rgba(111, 202, 255, 0.15);
  --nav-bg: rgba(247, 248, 250, 0.85);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --font-display: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #0f1117;
  --bg-card: #1a1d28;
  --bg-elevated: #232736;
  --text: #e8eaed;
  --text-secondary: #9ca3b4;
  --text-tertiary: #6b7385;
  --link: #e8eaed;
  --border: #2e3242;
  --accent: #6fcaff;
  --accent-soft: #1a2d3d;
  --accent-glow: rgba(111, 202, 255, 0.15);
  --nav-bg: rgba(15, 17, 23, 0.85);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.25);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ============================================
   Theme Toggle
   ============================================ */
#theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

#theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-md), 0 0 0 4px var(--accent-glow);
}

#theme-toggle .sun-icon,
#theme-toggle .moon-icon {
  position: absolute;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-theme="dark"] #theme-toggle .sun-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

[data-theme="dark"] #theme-toggle .moon-icon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

#theme-toggle .sun-icon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

#theme-toggle .moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* ============================================
   Main Layout
   ============================================ */
main {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 60px 32px 40px;
  flex: 1;
}

/* ============================================
   Hero
   ============================================ */
.hero {
  padding: 40px 0 20px;
  animation: fadeInUp 0.8s ease both;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.2rem;
  margin: 0 0 16px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero-tagline {
  font-size: 1.2rem;
  color: var(--text);
  margin: 0 0 12px;
  line-height: 1.5;
}

.highlight {
  position: relative;
  display: inline-block;
  color: var(--accent);
}

.highlight::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.3;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0 0 28px;
  max-width: 560px;
}

.hero-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1.5px solid transparent;
}

.btn svg {
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover {
  background: #5ab8e8;
  border-color: #5ab8e8;
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
  color: #fff !important;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--text) !important;
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
  background: var(--accent-soft);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 0.95rem;
}

/* ============================================
   Sticky Navigation
   ============================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 32px;
  margin: 0;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.nav-scrolled {
  box-shadow: var(--shadow-md);
  border-bottom-color: transparent;
}

.nav-inner {
  display: flex;
  gap: 0;
  max-width: 800px;
  margin: 0 auto;
  padding: 0;
  position: relative;
}

.nav-link {
  position: relative;
  z-index: 2;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text);
}

.nav-indicator {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  width: 80px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  z-index: 1;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================
   Sections
   ============================================ */
.section {
  margin-bottom: 80px;
  scroll-margin-top: 100px;
}

.section:last-of-type {
  margin-bottom: 0;
}

.section h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin: 0 0 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-number {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.75rem;
}

.section h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================
   Cards
   ============================================ */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  transition: all 0.25s ease;
  position: relative;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--accent);
  transform: translateY(-2px);
}

.card-meta {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.4;
}

.card-title a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.card-title a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.card-desc {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.6;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.card:hover .tag {
  border-color: var(--accent-soft);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Project cards */
.card-project {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 14px;
  transition: all 0.25s ease;
}

.card:hover .card-icon {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.gh-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 6px;
  transition: color 0.2s ease;
}

.gh-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.gh-link svg {
  display: block;
}

.card-award-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 100px;
  vertical-align: middle;
  margin-left: 6px;
  line-height: 1.6;
}

/* ============================================
   Awards & Certifications
   ============================================ */
.awards-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.award-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: all 0.25s ease;
}

.award-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.award-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: all 0.25s ease;
}

.award-card:hover .award-icon {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.award-body {
  flex: 1;
  min-width: 0;
}

.award-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 2px;
  color: var(--text);
}

.award-sub {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 6px;
}

.award-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ============================================
   Contact
   ============================================ */
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  text-align: center;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.contact-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}

.contact-text {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin: 0 0 28px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

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

/* ============================================
   Footer
   ============================================ */
footer {
  text-align: center;
  padding: 32px 24px 48px;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.footer-made {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin: 0 0 4px;
}

.footer-year {
  color: var(--text-tertiary);
  font-size: 0.8rem;
  margin: 0;
}

/* ============================================
   Animations
   ============================================ */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

/* ============================================
   Scrollbar (Webkit)
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ============================================
   Selection
   ============================================ */
::selection {
  background: var(--accent);
  color: #fff;
}

/* ============================================
   Mobile
   ============================================ */
@media (max-width: 640px) {
  main {
    padding: 32px 20px 24px;
  }

  .hero {
    padding: 20px 0 10px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .hero-tagline {
    font-size: 1.05rem;
  }

  .hero-links {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .nav {
    padding: 6px 20px;
  }

  .nav-link {
    font-size: 0.82rem;
    padding: 8px 14px;
  }

  .card {
    padding: 20px;
  }

  .contact-card {
    padding: 28px 24px;
  }

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

  .section h2::after {
    display: none;
  }

  #theme-toggle {
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 400px) {
  .hero h1 {
    font-size: 1.8rem;
  }
}

/* ============================================
   Reduce Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .card,
  .award-card,
  .contact-card {
    transition: border-color 0.2s ease;
  }

  .card:hover,
  .award-card:hover,
  .contact-card:hover {
    transform: none;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}