/* ===== Design Tokens ===== */
:root {
  /* Palette — deep navy to violet */
  --bg-primary: #0a0a12;
  --bg-secondary: #12121e;
  --bg-card: rgba(255 255 255 / 0.04);
  --bg-card-hover: rgba(255 255 255 / 0.08);
  --border-card: rgba(255 255 255 / 0.08);
  --border-card-hover: rgba(255 255 255 / 0.16);

  --text-primary: #f0f0f5;
  --text-secondary: #9a9ab0;
  --text-muted: #64647a;

  /* Accent gradient */
  --accent-1: #6c5ce7;
  --accent-2: #a855f7;
  --accent-3: #ec4899;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0 0 0 / 0.4), 0 1px 4px rgba(0 0 0 / 0.2);
  --shadow-card-hover: 0 8px 40px rgba(108 92 231 / 0.2), 0 2px 8px rgba(0 0 0 / 0.3);

  /* Radii */
  --radius-lg: 1.25rem;
  --radius-md: 0.75rem;
  --radius-sm: 0.5rem;
  --radius-pill: 100vw;

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  /* Spacing */
  --section-gap: 6rem;

  /* Gradient color interpolation */
  --in-oklch: ;
}

@supports (background: linear-gradient(in oklch, white, black)) {
  :root {
    --in-oklch: in oklch;
  }
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ===== Ambient Background ===== */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient-bg::before,
.ambient-bg::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.3;
  animation: float 20s ease-in-out infinite;
}

.ambient-bg::before {
  width: 600px;
  height: 600px;
  background: var(--accent-1);
  top: -10%;
  left: -5%;
}

.ambient-bg::after {
  width: 500px;
  height: 500px;
  background: var(--accent-3);
  bottom: -10%;
  right: -5%;
  animation-delay: -10s;
  animation-direction: reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(60px, -40px) scale(1.1); }
  66% { transform: translate(-40px, 30px) scale(0.95); }
}

/* ===== Noise Texture Overlay ===== */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 0;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  background: rgba(10 10 18 / 0.7);
  border-bottom: 1px solid rgba(255 255 255 / 0.06);
  transition: background 0.3s var(--ease-out-expo);
}

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

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg var(--in-oklch), var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.25s;
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg var(--in-oklch), var(--accent-1), var(--accent-2));
  border-radius: 1px;
  transition: width 0.3s var(--ease-out-expo);
}

.nav-links a:hover {
  color: var(--text-primary);
}

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

/* ===== Hero Section ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8rem 1.5rem 4rem;
  position: relative;
}

.hero-content {
  max-width: 720px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  background: rgba(108 92 231 / 0.12);
  border: 1px solid rgba(108 92 231 / 0.25);
  color: var(--accent-2);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

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

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg var(--in-oklch), var(--accent-1), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.3s var(--ease-out-expo);
}

.btn-primary {
  background: linear-gradient(135deg var(--in-oklch), var(--accent-1), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(108 92 231 / 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(108 92 231 / 0.5);
}

.btn-ghost {
  background: rgba(255 255 255 / 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255 255 255 / 0.1);
}

.btn-ghost:hover {
  background: rgba(255 255 255 / 0.1);
  border-color: rgba(255 255 255 / 0.2);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(108 92 231 / 0.1);
  color: var(--accent-1);
  border: 1px solid rgba(108 92 231 / 0.2);
}

.btn-secondary:hover {
  background: rgba(108 92 231 / 0.15);
  border-color: rgba(108 92 231 / 0.4);
  transform: translateY(-2px);
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: bounce-down 2s ease-in-out infinite;
}

.scroll-indicator svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
}

@keyframes bounce-down {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ===== Section Headers ===== */
.section {
  padding: var(--section-gap) 0;
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
}

/* ===== Category Filter Pills ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
}

.filter-pill {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-card);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
  font-family: inherit;
}

.filter-pill:hover {
  border-color: var(--border-card-hover);
  color: var(--text-primary);
  background: var(--bg-card);
}

.filter-pill.active {
  background: linear-gradient(135deg var(--in-oklch), var(--accent-1), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px rgba(108 92 231 / 0.3);
}

.pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4em;
  height: 1.4em;
  padding: 0 0.35em;
  border-radius: var(--radius-pill);
  background: rgba(255 255 255 / 0.2);
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 0.3rem;
}

/* ===== Project Cards Grid ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.project-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: all 0.4s var(--ease-out-expo);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg var(--in-oklch), rgba(108 92 231 / 0.06), rgba(168 85 247 / 0.03), transparent);
  opacity: 0;
  transition: opacity 0.4s;
}

.project-card:hover {
  border-color: var(--border-card-hover);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-4px);
}

.project-card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.card-icon.fintech { background: rgba(16 185 129 / 0.12); }
.card-icon.tools { background: rgba(59 130 246 / 0.12); }
.card-icon.data { background: rgba(245 158 11 / 0.12); }
.card-icon.creative { background: rgba(236 72 153 / 0.12); }
.card-icon.iot { background: rgba(20 184 166 / 0.12); }
.card-icon.infra { background: rgba(139 92 246 / 0.12); }
.card-icon.ai { background: rgba(168 85 247 / 0.12); }

.card-link-icon {
  color: var(--text-muted);
  transition: color 0.25s, transform 0.25s;
}

.project-card:hover .card-link-icon {
  color: var(--accent-2);
  transform: translate(2px, -2px);
}

.card-body {
  position: relative;
  z-index: 1;
  flex: 1;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.card-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.tag {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  background: rgba(255 255 255 / 0.05);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255 255 255 / 0.06);
}

/* ===== Timeline (Experience) ===== */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding-left: 1rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 23px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.timeline-item {
  position: relative;
  padding-left: 3.5rem;
  margin-bottom: 3rem;
}

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

.timeline-dot {
  position: absolute;
  left: 18px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-1);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.2);
  z-index: 2;
}

.timeline-content {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
}

.timeline-item:hover .timeline-content {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.15);
}

.timeline-header {
  margin-bottom: 1rem;
}

.timeline-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.timeline-company {
  display: block;
  font-size: 0.95rem;
  color: var(--accent-1);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.timeline-date {
  display: block;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline-list li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.timeline-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent-2);
  opacity: 0.7;
}

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

/* ===== Stats / About Section ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.stat-card {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  transition: all 0.3s var(--ease-out-expo);
}

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

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg var(--in-oklch), var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ===== Tech Stack Section ===== */
.tech-marquee {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  padding: 1rem 0;
}

.tech-track {
  display: flex;
  gap: 2rem;
  width: max-content;
  animation: marquee 40s linear infinite;
}

.tech-track:hover {
  animation-play-state: paused;
}

.tech-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: border-color 0.25s, color 0.25s;
}

.tech-item:hover {
  border-color: var(--border-card-hover);
  color: var(--text-primary);
}

.tech-item span {
  font-size: 1.1rem;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ===== Footer ===== */
.footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(255 255 255 / 0.06);
  text-align: center;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

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

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

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

/* ===== Scroll-Reveal Animation ===== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.stagger > .reveal:nth-child(2) { transition-delay: 60ms; }
.stagger > .reveal:nth-child(3) { transition-delay: 120ms; }
.stagger > .reveal:nth-child(4) { transition-delay: 180ms; }
.stagger > .reveal:nth-child(5) { transition-delay: 240ms; }
.stagger > .reveal:nth-child(6) { transition-delay: 300ms; }
.stagger > .reveal:nth-child(7) { transition-delay: 360ms; }
.stagger > .reveal:nth-child(8) { transition-delay: 420ms; }
.stagger > .reveal:nth-child(9) { transition-delay: 480ms; }
.stagger > .reveal:nth-child(10) { transition-delay: 540ms; }
.stagger > .reveal:nth-child(11) { transition-delay: 600ms; }
.stagger > .reveal:nth-child(12) { transition-delay: 660ms; }

/* ===== Reduced Motion ===== */
@property --animation-reduced {
  syntax: "*";
  inherits: false;
  initial-value: none;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: var(--animation-reduced) !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
  .timeline {
    padding-left: 0;
  }
  .timeline::before {
    left: 50%;
    transform: translateX(-50%);
  }
  .timeline-item {
    width: 50%;
    padding-left: 0;
    padding-right: 3rem;
  }
  .timeline-item:nth-child(even) {
    margin-left: auto;
    padding-right: 0;
    padding-left: 3rem;
  }
  .timeline-dot {
    left: 100%;
    transform: translateX(-50%);
  }
  .timeline-item:nth-child(even) .timeline-dot {
    left: 0;
  }
}
@media (max-width: 768px) {
  :root {
    --section-gap: 4rem;
  }

  .nav-links {
    gap: 1.25rem;
  }

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

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

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

@media (max-width: 480px) {
  .nav-links {
    display: none;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .filter-bar {
    gap: 0.35rem;
  }

  .filter-pill {
    padding: 0.4rem 1rem;
    font-size: 0.78rem;
  }

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