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

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bg: #08080a;
  --surface: #111113;
  --border: rgba(255,255,255,0.07);
  --border-h: rgba(255,255,255,0.14);
  --text: #ececef;
  --text-2: rgba(255,255,255,0.55);
  --text-3: rgba(255,255,255,0.3);
  --accent: #8b5cf6;
  --accent-2: #6366f1;
  --nav-h: 56px;
  --max-w: 720px;
  --ease: cubic-bezier(.16,1,.3,1);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Animated mesh gradient background */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-gradient::before,
.bg-gradient::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .12;
  animation: drift 20s ease-in-out infinite alternate;
}

.bg-gradient::before {
  width: 50vw; height: 50vw;
  top: -10%; left: -10%;
  background: var(--accent);
}

.bg-gradient::after {
  width: 45vw; height: 45vw;
  bottom: -15%; right: -15%;
  background: var(--accent-2);
  animation-delay: -10s;
  animation-direction: alternate-reverse;
}

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(8vw, 5vh) scale(1.1); }
  66%  { transform: translate(-5vw, 10vh) scale(.95); }
  100% { transform: translate(3vw, -5vh) scale(1.05); }
}

::selection { background: var(--accent); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* ============================================
   NAV
   ============================================ */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  background: rgba(8,8,10,0.65);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border-bottom: 1px solid var(--border);
}

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

.nav-logo {
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.03em;
  color: var(--text);
  text-decoration: none;
}

.nav-center {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  display: flex; gap: 2px;
}

.nav-center a {
  color: var(--text-3);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 999px;
  transition: color .15s, background .15s;
}
.nav-center a:hover { color: var(--text-2); background: rgba(255,255,255,0.05); }
.nav-center a.active { color: var(--text); background: rgba(255,255,255,0.08); }

#language-switcher {
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  font-family: var(--font);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
#language-switcher:hover { color: var(--text); border-color: var(--border-h); }
#language-switcher option { background: var(--surface); color: var(--text); }

/* ============================================
   MAIN
   ============================================ */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 100px 0;
  position: relative;
}

/* ============================================
   HERO / ABOUT
   ============================================ */
#about {
  padding-top: calc(var(--nav-h) + 80px);
  text-align: center;
}

/* Glow */
.hero-glow {
  position: absolute;
  top: -120px;
  left: 50%; transform: translateX(-50%);
  width: 600px; height: 480px;
  background: radial-gradient(ellipse,
    rgba(139,92,246,0.10) 0%,
    rgba(99,102,241,0.04) 40%,
    transparent 70%
  );
  pointer-events: none;
}

/* Content */
.hero { position: relative; z-index: 1; max-width: 560px; }

.hero-tagline {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--text-3);
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 32px;
}
.hero-tagline:empty { display: none; }

.hero-title {
  font-size: clamp(3.2rem, 10vw, 5rem);
  font-weight: 800;
  letter-spacing: -.055em;
  line-height: 1;
  margin-bottom: 20px;
  background: linear-gradient(180deg, #fff 30%, rgba(255,255,255,0.45));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  user-select: none;
}

.hero-subtitle {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--accent);
  margin-bottom: 28px;
}

.hero-desc {
  font-size: .95rem;
  line-height: 1.8;
  color: var(--text-2);
  white-space: pre-line;
  max-width: 480px;
  margin: 0 auto;
}

/* Lottie */
.hero-visual {
  margin-top: 56px;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.lottie-hero {
  width: 100%;
  max-width: 320px;
  height: auto;
  opacity: .8;
}

/* Tech strip */
.tech {
  width: 100%;
  margin-top: 72px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.tech-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--text-3);
  margin-bottom: 28px;
}

/* ============================================
   CAROUSEL
   ============================================ */
.about-carousel {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
}

.carousel-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.carousel-slide {
  position: absolute;
  top: 50%; left: 50%;
  width: clamp(34px, 6vw, 64px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: grid;
  place-items: center;
  opacity: .45;
}

.carousel-slide img {
  display: block;
  width: auto !important; height: auto !important;
  max-width: 85% !important; max-height: 85% !important;
  object-fit: contain !important;
  filter: grayscale(.5) brightness(.85);
}

/* ============================================
   PROJECTS
   ============================================ */
#projects {
  min-height: auto;
  padding: 80px 0;
}

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 540px;
}

.project-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  transition: border-color .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
  position: relative;
  overflow: hidden;
}

.project-card:hover {
  border-color: rgba(139,92,246,.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(139,92,246,.08);
}

.project-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.project-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.project-info {
  flex: 1;
  min-width: 0;
}

.project-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-bottom: 6px;
  line-height: 1.3;
}

.project-desc {
  font-size: .82rem;
  line-height: 1.6;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-badge {
  display: inline-block;
  margin-top: 16px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  padding: 4px 10px;
  border: 1px solid rgba(139,92,246,.2);
  border-radius: 999px;
  background: rgba(139,92,246,.06);
}

/* Screenshots */
.screenshot-strip {
  margin-top: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: 12px;
}
.screenshot-strip::-webkit-scrollbar { display: none; }

.screenshot-track {
  display: flex;
  gap: 8px;
  width: max-content;
}

.screenshot-img {
  height: 200px;
  width: auto;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Mobile */
@media (max-width: 640px) {
  .project-card { padding: 18px; }
  .project-icon { width: 52px; height: 52px; border-radius: 12px; }
  .screenshot-img { height: 160px; }
  #projects { padding: 60px 0; }
}

/* ============================================
   DIVIDER
   ============================================ */
.divider {
  border: none;
  height: 1px;
  max-width: var(--max-w);
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--border-h) 50%, transparent);
}

/* ============================================
   CONTACT
   ============================================ */
#contact { padding-bottom: 60px; }

.contact-header {
  text-align: center;
  margin-bottom: 40px;
}

.contact-header h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -.04em;
  margin-bottom: 10px;
}

.contact-header p {
  font-size: .95rem;
  color: var(--text-2);
}

.contact-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(24px, 5vw, 40px);
  transition: border-color .3s var(--ease);
}
.contact-card:hover { border-color: var(--border-h); }

.contact-form { display: grid; gap: 20px; }
.form-field { display: grid; gap: 6px; }

.contact-form label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-2);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--text-3); }

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: rgba(139,92,246,.45);
  box-shadow: 0 0 0 3px rgba(139,92,246,.1);
}

.contact-form textarea { resize: vertical; min-height: 100px; }

/* Button */
.btn-primary {
  width: 100%;
  padding: 11px 20px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), filter .2s;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139,92,246,.3);
  filter: brightness(1.08);
}
.btn-primary:active { transform: translateY(0); }

/* Links */
.contact-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.contact-links a {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-3);
  text-decoration: none;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color .15s, border-color .15s, background .15s;
}
.contact-links a:hover {
  color: var(--text-2);
  border-color: var(--border-h);
  background: rgba(255,255,255,0.03);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--text-3);
}

.footer-logo {
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: -.02em;
  color: var(--text-2);
}

/* ============================================
   BACK TO TOP
   ============================================ */
#toTopBtn {
  position: fixed;
  bottom: 28px; right: 28px;
  z-index: 90;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .3s, transform .3s var(--ease), color .15s, border-color .15s;
}
#toTopBtn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
#toTopBtn:hover {
  color: var(--text);
  border-color: var(--border-h);
}

/* ============================================
   REVEAL ANIMATION
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.in-view {
  opacity: 1;
  transform: none;
}
/* Stagger children */
.reveal:nth-child(2) { transition-delay: .1s; }
.reveal:nth-child(3) { transition-delay: .2s; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .nav-logo { display: none; }
  .nav-center { position: static; transform: none; }
  .nav-container { justify-content: center; gap: 12px; }

  main { padding: 0 16px; }
  section { padding: 60px 0; }

  #about { padding-top: calc(var(--nav-h) + 40px); }

  .hero-title { font-size: 2.8rem; }
  .hero-glow { width: 360px; height: 300px; top: -60px; }
  .lottie-hero { max-width: 220px; }
  .hero-visual { margin-top: 36px; }
  .tech { margin-top: 48px; }

  .contact-card { padding: 20px; }

  footer {
    flex-direction: column;
    gap: 6px;
    text-align: center;
    padding: 20px 16px;
  }
}

@media (max-width: 900px) {
  .carousel-slide { width: clamp(44px, 10vw, 72px); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none; opacity: 1; transform: none; }
  .carousel-slide { transition: none; }
}
