/* ========================================
   Design Tokens
   ======================================== */
:root {
  /* Colors */
  --color-bg: #0a0a0b;
  --color-bg-alt: #111113;
  --color-surface: #18181b;
  --color-border: rgba(255, 255, 255, 0.06);
  --color-text: #fafafa;
  --color-text-secondary: #a1a1aa;
  --color-text-muted: #52525b;
  --color-accent: #e4e4e7;
  --color-accent-glow: rgba(228, 228, 231, 0.08);
  --color-dot: #22c55e;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Spacing */
  --section-pad: clamp(80px, 12vw, 160px);
  --container-max: 1080px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

::selection {
  background: var(--color-text);
  color: var(--color-bg);
}

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

img {
  max-width: 100%;
  display: block;
}

/* ========================================
   Cursor Glow
   ======================================== */
.cursor-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
  opacity: 0;
}

body:hover .cursor-glow {
  opacity: 1;
}

/* ========================================
   Container
   ======================================== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 48px);
}

/* ========================================
   Navigation
   ======================================== */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 clamp(20px, 5vw, 48px);
  transition: all 0.4s var(--ease-out);
}

#navbar.scrolled {
  background: rgba(10, 10, 11, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
}

.nav-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.nav-logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: opacity 0.3s ease;
}

.nav-logo:hover {
  opacity: 0.7;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: 0.01em;
  transition: color 0.3s ease;
  position: relative;
}

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

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

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

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--color-text);
  transition: all 0.3s var(--ease-out);
  transform-origin: center;
}

.nav-toggle.active span:first-child {
  transform: translateY(3.75px) rotate(45deg);
}

.nav-toggle.active span:last-child {
  transform: translateY(-3.75px) rotate(-45deg);
}

/* Mobile menu */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  background: rgba(10, 10, 11, 0.97);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
}

.mobile-menu.active {
  opacity: 1;
  pointer-events: all;
}

.mobile-link {
  font-size: 32px;
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: color 0.3s ease;
  letter-spacing: -0.02em;
}

.mobile-link:hover {
  color: var(--color-text);
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 clamp(20px, 5vw, 48px);
  position: relative;
  overflow: hidden;
}

/* Dynamic Background Glows */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  z-index: 0;
  filter: blur(120px);
  opacity: 0.15;
  animation: floatOrb 25s infinite ease-in-out alternate;
  pointer-events: none;
}

.hero::before {
  top: -20%;
  left: -10%;
  background: #8A2BE2;
}

.hero::after {
  bottom: -20%;
  right: -10%;
  background: #C77DFF;
  animation-delay: -10s;
  animation-duration: 30s;
  animation-direction: alternate-reverse;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(10vw, 5vw) scale(1.1); }
  66% { transform: translate(-5vw, 15vw) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--container-max);
  margin: 0 auto;
  width: 100%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  letter-spacing: 0.02em;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-dot);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

.hero h1 {
  font-size: clamp(48px, 10vw, 96px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}

.hero-line {
  display: block;
}

.hero-accent {
  color: var(--color-text-muted);
}

.hero-subtitle {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-width: 480px;
  margin-bottom: 40px;
  font-weight: 400;
}

.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  border: none;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn-primary:hover {
  background: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 255, 255, 0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover {
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Scroll indicator */
.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
}

.scroll-line {
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, var(--color-text-muted), transparent);
  animation: scrollDown 2s ease-in-out infinite;
}

@keyframes scrollDown {
  0% { transform: scaleY(0); transform-origin: top; opacity: 1; }
  50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
  51% { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 1; }
}

/* ========================================
   Sections
   ======================================== */
.section {
  padding: var(--section-pad) 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}

.section-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: clamp(40px, 6vw, 64px);
}

/* ========================================
   About Section
   ======================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: start;
}

.about-lead {
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.6;
  color: var(--color-text);
  margin-bottom: 24px;
  font-weight: 400;
}

.about-text p {
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.7;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.detail-group {
  margin-bottom: 28px;
}

.detail-group:last-child {
  margin-bottom: 0;
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.detail-value {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  display: inline-block;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  transition: all 0.3s ease;
}

.skill-tag:hover {
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

/* ========================================
   Timeline / Experience
   ======================================== */
.timeline {
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--color-border);
}

.timeline-item {
  display: flex;
  gap: 32px;
  margin-bottom: 48px;
  position: relative;
}

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

.timeline-marker {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--color-text-muted);
  background: var(--color-bg-alt);
  margin-top: 4px;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.timeline-item:hover .timeline-marker {
  border-color: var(--color-text);
  background: var(--color-text);
}

.timeline-content {
  flex: 1;
  padding-bottom: 8px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 16px;
}

.timeline-role {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.timeline-company {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
  margin-top: 4px;
}

.timeline-desc {
  color: var(--color-text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

/* Company Details (Dropdown) */
.company-details {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.company-summary {
  cursor: pointer;
  padding: 16px 20px;
  list-style: none; /* removes default arrow in most browsers */
  user-select: none;
}

.company-summary::-webkit-details-marker {
  display: none; /* removes default arrow in webkit */
}

.company-summary:hover {
  background: rgba(255, 255, 255, 0.03);
}

.summary-chevron {
  color: var(--color-text-muted);
  transition: transform 0.3s ease;
}

details[open] .summary-chevron {
  transform: rotate(180deg);
}

.company-roles {
  padding: 4px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.company-role-item {
  position: relative;
  padding-left: 20px;
}

.company-role-item.border-left::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
  border-radius: 2px;
}

.role-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.role-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.role-period {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ========================================
   Projects Grid
   ======================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.project-card {
  display: block;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: all 0.4s var(--ease-out);
  overflow: hidden;
}

.project-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.project-card-inner {
  padding: 32px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 220px;
}

.project-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  margin-bottom: 24px;
  transition: all 0.3s ease;
}

.project-card:hover .project-icon {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.08);
}

.project-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.project-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  flex: 1;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.project-lang {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.project-arrow {
  font-size: 16px;
  color: var(--color-text-muted);
  transition: all 0.3s var(--ease-out);
}

.project-card:hover .project-arrow {
  color: var(--color-text);
  transform: translate(3px, -3px);
}

/* "More" project card */
.project-card-more {
  background: transparent;
  border-style: dashed;
}

.project-card-more:hover {
  background: var(--color-surface);
  border-style: solid;
}

.project-more-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.project-more-count {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--color-text-muted);
  transition: color 0.3s ease;
}

.project-card-more:hover .project-more-count {
  color: var(--color-text);
}

.project-more-label {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-top: 8px;
  margin-bottom: 16px;
  transition: color 0.3s ease;
}

.project-card-more:hover .project-more-label {
  color: var(--color-text-secondary);
}

/* ========================================
   Contact Section
   ======================================== */
.contact-content {
  max-width: 560px;
}

.contact-text {
  font-size: clamp(18px, 2.2vw, 22px);
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
}

.contact-email {
  display: inline-block;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
  position: relative;
  transition: opacity 0.3s ease;
  margin-bottom: 40px;
}

.contact-email::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease-out);
}

.contact-email:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.contact-links {
  display: flex;
  gap: 20px;
}

.contact-link {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  transition: all 0.3s var(--ease-out);
}

.contact-link:hover {
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-3px);
}

/* ========================================
   Footer
   ======================================== */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--color-border);
}

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

.footer-text {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ========================================
   Animations (Scroll Reveal)
   ======================================== */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

[data-delay="1"] { transition-delay: 0.1s; }
[data-delay="2"] { transition-delay: 0.2s; }
[data-delay="3"] { transition-delay: 0.3s; }
[data-delay="4"] { transition-delay: 0.5s; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  
  .nav-toggle {
    display: flex;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

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

  .timeline-header {
    flex-direction: column;
    gap: 4px;
  }

  .hero h1 {
    font-size: clamp(40px, 12vw, 72px);
  }

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

  .hero-subtitle br {
    display: none;
  }
}

@media (max-width: 480px) {
  .project-card-inner {
    padding: 24px;
    min-height: 180px;
  }

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

  .btn {
    width: 100%;
    text-align: center;
  }
}
